ドキュメント

Unity Engine


Unity Engine


image

The texture to display in this image. If you assign a Texture or Texture2D, the Image element will resize and show the assigned texture.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

public Texture image { get; set; }

Remarks

The following example creates an
Image
element and assigns a texture to it.

Examples

using UnityEngine;using UnityEngine.UIElements;public class AddImageExample : MonoBehaviour{ public Texture2D myTexture; void OnEnable() { var root = GetComponent<UIDocument>().rootVisualElement; var imageElement = new Image(); imageElement.image = myTexture; root.Add(imageElement); }}