top of page

GameObjectExtensions

Extensions for the GameObject type.

Methods

DetachAllChildren

Detaches all of gameObject's children.

DetachChild

Detaches the selected child.

DetachChildren

Detaches all children with indices.

DetachParent

Detaches the parent.

HasChildren

Returns true if gameObject has children.

HasParent

Returns true if gameObject has a parent.

HasSibling

Returns true if gameObject has siblings.

InverseTransformDirection

Transforms a direction from world space to local space.

InverseTransformPoint

Transforms a position from world space to local space.

InverseTransformVector

Transforms a vector from world space to local space.

IsMyAncestor

Returns true if the checked object is an ancestor of gameObject.

IsMyChild

Returns true if the checked object is a child of gameObject.

IsMyDescendant

Returns true if the checked object is a descendant of gameObject.

IsMyParent

Returns true if the checked object is a parent of gameObject.

IsMyRootAncestor

Returns true if the checked object is the root of gameObject.

IsMySibling

Returns true if the checked object is a siblings of gameObject.

IsMyTreemate

Returns true if the checked object is on the same tree as gameObject.

LookAt

Rotates so the forward point targets current position.

ReorderChildrenIndices

Reorders the indices of children so that they match the order of children in array.

ReturnAncestors

Returns an array of all ancestors. Ancestors include the parent, the parent's parent and all other objects higher on the branch from parent.

ReturnBranch

Returns an array including self, children, parent, siblings, descendants and ancestors.

ReturnChild

Returns the child at checked index. If no child is found returns null.

ReturnChildCount

Returns the number of children the gameObject has.

ReturnChildren

Returns an array of all child objects.

ReturnComponentInAncestors

Search through each ancestor of the gameObject and return the first instance of T found. Ancestors include the parent, the parent's parent and all other objects higher on the branch.

ReturnComponentInBranch

Search gameObject, children, parent, siblings, descendants and ancestors, in that order, and return the first instance of T found.

ReturnComponentInChildren

Search through each child of the gameObject and return the first instance of T found.

ReturnComponent
InDescendants

Search through each descendant of the gameObject and return the first instance of T found. Descendant include children, children of children and all other objects lower on the branch from children.

Search the parent object for an instance of T.

ReturnComponentInSiblings

Search through each sibling of the gameobject for an instance of T and return the first instance of the object found.

ReturnComponentInTree

Search gameObject, children, parent, siblings, descendants, ancestors, and all other objects that share a tree with gameObject, in that order, and return the first instance of T found.

ReturnComponents
InAncestors

Search through each ancestor of the gameObject and return an array of all instances of T found. Ancestors include the parent, the parent's parent and all other objects higher on the branch.

ReturnComponentsInBranch

Search self, children, parent, siblings, descendants and ancestors, in that order, and return an array of all instances of T found.

ReturnComponentsInChildren

Search through each child of gameObject and return an array of all instances of T found.

ReturnComponents
InDescendants

Search through each descendant of the game object and return an array of all instances of T found. Descendants include children, children of children and all other objects lower on the branch from children.

ReturnComponentsInParent

Search parent and return an array of all instances of T it found.

ReturnComponentsInSiblings

Search through each sibling of the object and return an array of all instances of T.

ReturnComponentsInTree

Search self, children, parent, siblings, descendants, ancestors, and all other objects that share a tree with gameObject, in that order, and return an array of all instances of T found.

ReturnDescendants

Returns and array of all descendants. Descendants include children, children of children and all other objects lower on the branch from children.

ReturnForward

Return's the gameObjects blue axis in world space.

ReturnLocalPosition

The position of the gameObject's transform relative to the parent's transform.

ReturnLocalRotation

The rotation of the transform relative to the parent's rotation in Quaternion.

ReturnLocalRotation
EulerAngles

The gameObject's rotation in Euler angles relative to the parent's rotation.

ReturnLocalScale

The scale of the gameObject's transform relative to the parent.

ReturnLocalToWorldMatrix

A matrix that transforms the local space to world space.

ReturnParent

Search the parent object for an instance of T.

ReturnPosition

The gameObject's world position.

ReturnRight

The gameObject's red axis in world space.

ReturnRootAncestor

Returns the root ancestor.

ReturnRotation

The gameObject's rotation in world space.

ReturnRotationEulerAngles

Return the euler angle of gameObject's rotation.

ReturnScale

Detaches all of gameObject's children.

ReturnSiblingIndex

Returns the gameObject’s sibling index.

ReturnSiblings

Returns an array of all siblings.

ReturnTree

Returns an array including self, children, parent, siblings, descendants and ancestors, and all other objects that share a tree with gameObject equal to the provided bool value.

ReturnUp

The gameObject's green axis in world space.

ReturnWorldToLocalMatrix

Matrix that transforms a point in world space to local space.

ReturnWorldPosition

The world space position of the gameObject.

Rotate

Rotates the gameObect.

RotateAround

Rotates the gameObject around an axis, while passing through point by angle.

SetAncestorsComponent
Enabled

Sets the enabled state of the first instance of a component with type found on an ancestor equal to the new value. Ancestors include the parent, the parent's parent and all other objects higher on the branch.

SetAncestorsComponents
Enabled

 

Sets the enabled state of all instances of a component with type found on a parent equal to the new value.Ancestors include the parent, the parent's parent and all other objects higher on the branch.

SetAsFirstSibling

Move the gameObject to the top of the parent's child list.

SetAsLastSibling

Move the gameObject to the bottom of the parent's child list.

SetBranchComponentsEnabled

Sets the enabled state of all instances of a component with type found on gameObject, children, parent, siblings, descendants and ancestors, equal to the new value.

SetChildrensComponent
Enabled

Sets the enabled state of the first instance of a component with type found on a child equal to the new value.

SetComponentEnabled

Sets the enabled state of the first instance of a component with type found on the gameObject equal to the new value.

SetComponentsEnabled

Sets the enabled state of all instances of a component with type found on the gameObject equal to the new value.

SetDescendantsComponent
Enabled

Sets the enabled state of the first instance of a component with type found on a descendant equal to the new value. Descendants include children, children of children and all other objects lower on the branch than children.

SetDescendantsComponents
Enabled

 

Sets the enabled state of all instances of a component with type found on any descendant equal to the new value. Descendants include children, children of children and all other objects lower on the branch from children.

SetLocalRotation

Sets the rotation of the transform relative to the parent's rotation to the new quaternion.

SetChildrensComponents
Enabled

 

Sets the enabled state of all instances of a component with type found on any child equal to the new value.

SetForward

Sets the gameObject's forward.

SetLocalPosition

Sets the position of the gameObject's transform relative to the parent's transform to the new position.

SetLocalRotationEulerAngles

Sets the gameObject's rotation in Euler angles relative to the parent's rotation.

SetLocalScale

Sets the local scale of the gameObject's transform relative to the new scale.

SetParent

Sets the parent.

SetParentsComponentEnabled

Sets the enabled state of the first instance of a component with type found on a parent equal to the new value.

SetParentsComponents
Enabled

 

Sets the enabled state of all instances of a component with type found on a parent equal to the new value.

SetPosition

Search through each child of the gameObject and return the first instance of T found.

SetRotationEulerAngles

Sets the gameObject's rotation.

SetSiblingsComponent
Enabled

Sets the enabled state of the first instance of a component with type found on a sibling equal to the new value.

SetSiblingsComponents
Enabled

 

Sets the enabled state of all instances of a component with type found on a sibling equal to the new value.

SetSiblingIndex

Sets the gameObject's sibling index.

SetTreeComponentEnabled

Sets the enabled state of the first instance of T found in self, children, parent, siblings, descendants and ancestors, and other objects that share a tree with gameObject, searched in that order, equal to the new value.

SetTreeComponentsEnabled

Sets the enabled state of all instances of a component with type found on gameObject, children, parent, siblings, descendants and ancestors, and other objects that share a tree with gameObject, equal to the new value.

TransformDirection

Transforms a direction from world space to local space.

TransformHasChanged

Returns true if gameObject's transform changed since the last time the flag was set false.

TransformPoint

Transforms a point from local space to world space.

TransformVector

Transforms the vector from local space to world space.

Translate

Moves a gameObject in the direction of and the distance of translation.

TreeCapacity

Returns the gameObject's transform hierarchyCapacity.

TreeCount

Returns the number of objects in the gameObject's tree.

bottom of page