Class Image
A simple image element
public sealed class Image : ArrangableElement, IGameObjectWrapper
- Inheritance
-
Image
- Implements
- Inherited Members
- Extension Methods
Constructors
Image(LayoutRoot, Sprite, string)
Creates an image
public Image(LayoutRoot onLayout, Sprite sprite, string name = "New Image")
Parameters
onLayout
LayoutRootThe layout root to draw the image on
sprite
SpriteThe sprite to use to render the image
name
stringThe name of the image element
Properties
GameObject
The UnityEngine.GameObject underlying this UI element
public GameObject GameObject { get; }
Property Value
- GameObject
Height
The desired height of the image; it will be scaled as needed
public float Height { get; set; }
Property Value
PreserveAspectRatio
Whether to preserve the aspect ratio of the image when scaling
public bool PreserveAspectRatio { get; set; }
Property Value
Sprite
The current sprite underlying the image
public Sprite Sprite { get; set; }
Property Value
Tint
A color to apply over top of the image
public Color Tint { get; set; }
Property Value
Width
The desired width of the image; it will be scaled as needed
public float Width { get; set; }
Property Value
Methods
ArrangeOverride(Vector2)
Internal implementation to position the object within the allocated space.
protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)
Parameters
alignedTopLeftCorner
Vector2The space available for the element.
DestroyOverride()
Internal implementation to perform any additional cleanup when the element is destroyed
protected override void DestroyOverride()
MeasureOverride()
Internal implementation to calculate desired size.
protected override Vector2 MeasureOverride()