Skip to content

format

typescript
RectTransform.IsContain(value)

class: RectTransform

description

Check if a point is within the rectangular range of a RectTransform.

parameter

param_nametypedescription
valueVector2The coordinates of the point to be checked.

reture

typedescription
booleanWhether the point is within the rectangular range of the RectTransform.

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.IsContain(new Vector2(1,1));