SRectTransform
| 函数 | SetParent | Set the parent of the transform. |
| 函数 | SetInsetAndSizeFromParentEdge | Set the distance of this rectangle relative to a specified edge of the parent rectangle, while also setting its size. |
| 函数 | SetSizeWithCurrentAnchors | Makes the RectTransform calculated rect be a given size on the specified axis. |
| 属性 | Rect | – |
| 属性 | anchorMin | The normalized position in the parent RectTransform that the lower left corner is anchored to. |
| 属性 | anchorMax | – |
| 属性 | anchoredPosition3D | – |
| 属性 | anchoredPosition | – |
| 属性 | sizeDelta | The size of this RectTransform relative to the distances between the anchors. |
| 属性 | pivot | The normalized position in this RectTransform that it rotates around. |
| 属性 | offsetMin | The offset of the lower left corner of the rectangle relative to the lower left anchor. |
| 属性 | offsetMax | The offset of the upper right corner of the rectangle relative to the upper right anchor. |
| 属性 | GameObject | – |
函数
SetParent
Set the parent of the transform.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| parent | SGameObject | – |
| worldPositionStays | bool | – |
返回值
void
示例
Space.Host.ExecutingObject.RectTransform.SetParent(anotherGameObject)
SetInsetAndSizeFromParentEdge
Set the distance of this rectangle relative to a specified edge of the parent rectangle, while also setting its size.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| edge | int | – |
| inset | float | – |
| size | float | – |
返回值
void
示例
Space.Host.ExecutingObject.RectTransform.SetInsetAndSizeFromParentEdge(2, 3.0, 10.0)
SetSizeWithCurrentAnchors
Makes the RectTransform calculated rect be a given size on the specified axis.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| vertical | bool | – |
| size | float | – |
返回值
void
示例
Space.Host.ExecutingObject.RectTransform.SetSizeWithCurrentAnchors(true, 10.0)
属性
Rect只读
示例
rect = Space.Host.ExecutingObject.RectTransform.Rect
anchorMin
The normalized position in the parent RectTransform that the lower left corner is anchored to.
示例
Space.Host.ExecutingObject.RectTransform.anchorMin= Vector.New(0.3,0.3,0)
anchorMax
示例
Space.Host.ExecutingObject.RectTransform.anchorMax= Vector.New(0.7,0.6,0)
anchoredPosition3D
示例
Space.Host.ExecutingObject.RectTransform.anchoredPosition3D= Vector.New(0.7,0.6,0)
anchoredPosition
示例
Space.Host.ExecutingObject.RectTransform.anchoredPosition= Vector.New(0.7,0.6,0)
sizeDelta
The size of this RectTransform relative to the distances between the anchors.
示例
Space.Host.ExecutingObject.RectTransform.sizeDelta= Vector.New(90,90,0)
pivot
The normalized position in this RectTransform that it rotates around.
示例
Space.Host.ExecutingObject.RectTransform.pivot= Vector.New(0.4,0.4,0)
offsetMin
The offset of the lower left corner of the rectangle relative to the lower left anchor.
示例
Space.Host.ExecutingObject.RectTransform.offsetMin= Vector.New(-50,-50,0)
offsetMax
The offset of the upper right corner of the rectangle relative to the upper right anchor.
示例
Space.Host.ExecutingObject.RectTransform.offsetMax= Vector.New(50,50,0)
GameObject只读
示例
theGameObject = Space.Host.ExecutingObject.RectTransform.GameObject



