Skip to content

格式

typescript
Control.rectTransform

所属类: Control

描述

控件的RectTransform组件。

RectTransform是UI控件中中特有的组件,它为UI控件提供了位置、尺寸、旋转和锚点等信息,用于控制UI控件的变换和布局。

参数

参数名类型描述

返回值

类型描述
RectTransformRectTransform组件

代码示例

typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;		
let button = canvas.FindChild(Button,"Button");
button.rectTransform;