Transform
Variables
up
Transform.up
The green axis of this transform in world space.
Example
transform.up
right
Transform.right
The red axis of this transform in world space.
Example
transform.right
forward
Transform.forward
A normalized vector that represents the blue axis of this transform in world space.
Example
transform.forward
position
Transform.position
The world space position of this transform.
Example
transform.position
positionAbove
Transform.positionAbove
A position one unit above the world space position of this transform.
Example
transform.positionAbove
eulerAngles
Transform.eulerAngles
The world space rotation of this transform as euler angles in degrees.
Example
transform.eulerAngles
localPosition
Transform.localPosition
The local space position of this transform.
Example
transform.localPosition
localScale
Transform.localScale
The scale of this transform relative to its parent.
Example
transform.localScale
localEulerAngles
Transform.localEulerAngles
The local space rotation of this transform as euler angles in degrees.
Example
transform.localEulerAngles
Functions
SetParent
function Transform.SetParent((Transform)Parent)
Parameter | Type | Description |
---|---|---|
Parent | Transform |
Desired parent. Set nil for no parent. |
Transform.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
transform.SetParent(otherTransform)
SetActive
function Transform.SetActive((bool)Activate or Deactivate)
Parameter | Type | Description |
---|---|---|
Activate or Deactivate | bool |
Desired activation status. |
Transform.SetActive
Activates/Deactivates the object based on the bool parameter value
Example
transform.SetActive(true)
IsActive
function Transform.IsActive()
Transform.IsActive
Returns true if the object is active in the hierarchy
Example
transform.IsActive()
Recycle
function Transform.Recycle()
Transform.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
transform.Recycle()
Destroy
function Transform.Destroy()
Transform.Destroy
This will destroy this object. It will no longer exist.
Example
transform.Destroy()