Skip to content

format

typescript
RectTransform.rect

class: RectTransform

description

The position and size of RectTransform in the screen coordinate system.

parameter

param_nametypedescription

reture

typedescription
RectThe position and size in the screen coordinate system.

code example

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

let rectTransform = button.rectTransform;
rectTransform.rect;