Class UITransform
Positions a fixed-size UI element relative to the viewport or another UI element.
public sealed class UITransform : Component, IDisposable
- Inheritance
-
UITransform
- Implements
- Inherited Members
Constructors
UITransform(GameObject, Game)
Positions a fixed-size UI element relative to the viewport or another UI element.
public UITransform(GameObject gameObject, Game game)
Parameters
gameObjectGameObjectgameGame
Properties
Anchor
Normalized attachment point inside the parent rectangle.
public Vector2 Anchor { get; set; }
Property Value
AnchoredPosition
Pixel offset from the anchor.
public Vector2 AnchoredPosition { get; set; }
Property Value
Children
public IReadOnlyList<UITransform> Children { get; }
Property Value
Parent
public UITransform? Parent { get; set; }
Property Value
Pivot
Normalized point on this rectangle placed at the anchor.
public Vector2 Pivot { get; set; }
Property Value
Rect
public UIRect Rect { get; }
Property Value
Size
Element size in screen pixels.
public Vector2 Size { get; set; }
Property Value
Methods
OnDestroy()
public override void OnDestroy()
SetParent(UITransform?, bool)
Changes the layout parent and optionally preserves the element's screen position.
public void SetParent(UITransform? newParent, bool screenPositionStays = true)
Parameters
newParentUITransformscreenPositionStaysbool