Struct UICanvas
Root component for UI elements (entities with RectTransform and Transform components).
Namespace: Unity.Tiny.UILayout
Syntax
public struct UICanvas : IComponentData
Fields
camera
The entity with the Camera2D component used for layouting calculations.
Declaration
[EntityWithComponents(new Type[]{typeof(Camera2D)})]
public Entity camera
Field Value
Type | Description |
---|---|
Entity |
matchWidthOrHeight
Scales the Canvas to match the width or height of the reference resolution, or a combination of width and height.
A value of 0 scales the Canvas according to the difference between the current screen resolution width and the reference resolution width.
A value of 1 scales Canvas according to the difference between the current screen resolution height and the reference resolution height.
Values between 0 and 1 scale the Canvas based on a combination of the relative width and height.
Declaration
public float matchWidthOrHeight
Field Value
Type | Description |
---|---|
System.Single |
referenceResolution
The resolution the UI layout is designed for (in pixels).
Declaration
public float2 referenceResolution
Field Value
Type | Description |
---|---|
float2 |
uiScaleMode
How UI elements in the Canvas are scaled.
Declaration
public UIScaleMode uiScaleMode
Field Value
Type | Description |
---|---|
UIScaleMode |
Properties
Default
Declaration
public static UICanvas Default { get; }
Property Value
Type | Description |
---|---|
UICanvas |