Skip to content

RectTransform

The RectTransform class is used to manage the position, rotation, and scale of UI elements.

You can refer to Control.rectTransform for how to obtain it.

成员变量

RectTransform.name : string
(Read-only) The name of the control that the RectTransform is attached to.
RectTransform.control : Control
(Read-only) The control object that the RectTransform is attached to.
RectTransform.top : number
The distance from the top of the transform matrix to the top of its parent.
RectTransform.bottom : number
The distance from the bottom edge of the transform matrix to the bottom edge of its parent.
RectTransform.left : number
The distance between the left edge of the transformation matrix and the left edge of the parent, relative to the parent.
RectTransform.right : number
The distance between the right edge of the transformation matrix and the right edge of the parent, relative to the parent.
RectTransform.offsetMin : Vector2
(Read Only) The offset of the RectTransform's bottom left corner relative to the bottom left anchor point.
RectTransform.offsetMax : Vector2
(Read Only) The maximum offset of the RectTransform.
RectTransform.anchorMin : Vector2
The normalized position to which the RectTransform's bottom-left corner is anchored.
RectTransform.anchorMinX : number
The minimum value of the X-axis coordinate of the anchor point of the RectTransform.
RectTransform.anchorMinY : number
The minimum Y-axis coordinate value of the anchor point of the RectTransform.
RectTransform.anchorMax : Vector2
The normalized position to which the RectTransform's top-right corner is anchored.
RectTransform.anchorMaxX : number
The maximum value of the X-axis coordinate of the anchor point of the RectTransform.
RectTransform.anchorMaxY : number
The maximum Y-axis coordinate value of the anchor point of the RectTransform.
RectTransform.aabb : Rect
(Read Only) The bounding box of the RectTransform.
RectTransform.pivot : Vector2
The center point position of RectTransform.
RectTransform.rect : Rect
The position and size of RectTransform in the screen coordinate system.
RectTransform.posX : number
The X-axis coordinate value of the RectTransform.
RectTransform.posY : number
The Y-axis coordinate value of the RectTransform.
RectTransform.width : number
The width of the matrix transformation.
RectTransform.height : number
The height of the RectTransform.
RectTransform.localPosition : Vector2
The local position of the RectTransform relative to its parent container.
RectTransform.localScale : Vector2
The local scale of the RectTransform relative to its parent container.
RectTransform.localRotation : Vector2
The local rotation of the RectTransform relative to its parent container.
RectTransform.worldPosition : Vector2
(Read Only) The world position of the RectTransform.
RectTransform.worldScale : Vector2
(Read-only) The world scale of the RectTransform.
RectTransform.worldRotation : Vector2
(Read-only) The world rotation of the RectTransform.
RectTransform.worldMatrix : Matrix4x4
(Read-only) The world matrix of the RectTransform.

成员方法

RectTransform.IsContain ( value : Vector2 ) : boolean
Check if a point is within the rectangular range of a RectTransform.