Table of Contents

Class Image

Namespace
MagicUI.Elements
Assembly
MagicUI.dll

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 LayoutRoot

The layout root to draw the image on

sprite Sprite

The sprite to use to render the image

name string

The 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

float

PreserveAspectRatio

Whether to preserve the aspect ratio of the image when scaling

public bool PreserveAspectRatio { get; set; }

Property Value

bool

Sprite

The current sprite underlying the image

public Sprite Sprite { get; set; }

Property Value

Sprite

Tint

A color to apply over top of the image

public Color Tint { get; set; }

Property Value

Color

Width

The desired width of the image; it will be scaled as needed

public float Width { get; set; }

Property Value

float

Methods

ArrangeOverride(Vector2)

Internal implementation to position the object within the allocated space.

protected override void ArrangeOverride(Vector2 alignedTopLeftCorner)

Parameters

alignedTopLeftCorner Vector2

The 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()

Returns

Vector2