Skip to content

RectTransform

Functions

SetParent

 function RectTransform.SetParent((rectTransform)Parent)
Parameter Type 📝 Description
Parent rectTransform Desired parent. Set nil for no parent.

RectTransform.SetParent

Sets this transform as a child of another transform, or set it to have no parents if using the parameter nil. This will return this transform.

Example

rectTransform.SetParent(otherTransform)
Sets the transform to be a child of the transform otherTransform.


SetActive

 function RectTransform.SetActive((bool)Activate or Deactivate)
Parameter Type 📝 Description
Activate or Deactivate bool Desired activation status.

RectTransform.SetActive

Activates/Deactivates the object based on the bool parameter value

Example

rectTransform.SetActive(true)
Activates the transform.


IsActive

 function RectTransform.IsActive()

RectTransform.IsActive

Returns true if the object is active in the hierarchy

Example
rectTransform.IsActive()

Recycle

 function RectTransform.Recycle()

RectTransform.Recycle

This will disable this transform and register it back into the ObjectPool so it can be spawned again when a similar object is needed. If you have a reference to this transform you should get rid of it after calling recycle.

Example
rectTransform.Recycle()

Destroy

 function RectTransform.Destroy()

RectTransform.Destroy

This will destroy this object. It will no longer exist.

Example
rectTransform.Destroy()

Comments