Class SuperRectTransform
Represents a UGUI RectTransform
This class is used to simplify the access to the RectTransform of a UGUI GameObject, it provides a more intuitive way to access the RectTransform properties as they behave exactly like in the Inspector.
// Stretch All
SuperRectTransform transform = GetComponent<RectTransform>();
transform.Left = 10;
transform.Right = 10;
transform.Bottom = 10;
transform.Top = 10;
// Center
SuperRectTransform transform = GetComponent<RectTransform>();
transform.PosX = 10;
transform.PosY = 10;
transform.Width = 100;
transform.Height = 100;
public class SuperRectTransform
- Inheritance
-
SuperRectTransform
Constructors
SuperRectTransform(RectTransform)
Represents a UGUI RectTransform with StretchAll Anchors
public SuperRectTransform(RectTransform rectTransform)
Parameters
rectTransform
RectTransformThe RectTransform to initialize with
Properties
Anchor
Anchor Preset of the RectTransform
public UGUIAnchor Anchor { get; set; }
Property Value
Bottom
Distance from the bottom edge of the parent RectTransform
public float Bottom { get; set; }
Property Value
Height
Height of the RectTransform
public float Height { get; set; }
Property Value
Left
Distance from the left edge of the parent RectTransform
public float Left { get; set; }
Property Value
ParentRect
Parent RectTransform of the RectTransform
public RectTransform ParentRect { get; }
Property Value
Pivot
Pivot of the RectTransform
public Vector2 Pivot { get; set; }
Property Value
PosX
X-Position of the RectTransform
public float PosX { get; set; }
Property Value
PosY
Y-Position of the RectTransform
public float PosY { get; set; }
Property Value
PosZ
Z-Position of the RectTransform
public float PosZ { get; set; }
Property Value
Right
Distance from the right edge of the parent RectTransform
public float Right { get; set; }
Property Value
Top
Distance from the top edge of the parent RectTransform
public float Top { get; set; }
Property Value
Width
Width of the RectTransform
public float Width { get; set; }
Property Value
Methods
ToString()
public override string ToString()
Returns
Operators
implicit operator RectTransform(SuperRectTransform)
public static implicit operator RectTransform(SuperRectTransform superRectTransform)
Parameters
superRectTransform
SuperRectTransform
Returns
implicit operator SuperRectTransform(RectTransform)
public static implicit operator SuperRectTransform(RectTransform rectTransform)
Parameters
rectTransform
RectTransform