Hierarchy Actions
Hierarchy actions help you read and modify parent, child, and sibling relationships between Transforms.
Use them when you need to find related objects in a hierarchy, move through sibling order, count children, or re-parent objects at runtime.
Finding Related Transforms
Find Ancestor
TransformFindAncestor searches upward through the parent chain until it finds an ancestor with the specified name.
| Parameter | Description |
|---|---|
| Transform | The starting Transform. |
| Ancestor Name | Name of the parent or ancestor to search for. |
| Result | Stores the matching ancestor, or None if not found. |
Find Child
TransformFindChild searches for a child Transform by name.
| Parameter | Description |
|---|---|
| Transform | The parent Transform to search in. |
| Child Name | Name of the child to find. |
| Find Child | Stores the matching child, or None if not found. |
Get Parent
TransformGetParent gets the direct parent of a Transform.
| Parameter | Description |
|---|---|
| Transform | The Transform to inspect. |
| Get Parent | Stores the direct parent Transform. |
Get Root
TransformGetRoot gets the top-most Transform in the hierarchy.
| Parameter | Description |
|---|---|
| Transform | The Transform to inspect. |
| Get Root | Stores the root Transform for that hierarchy. |
Is Child Of
TransformIsChildOf checks whether one Transform belongs under another Transform in the hierarchy.
| Parameter | Description |
|---|---|
| Transform | The Transform to test. |
| Parent | The potential parent or ancestor. |
| Result | Stores true if the Transform is a child of the given parent. |
Working With Children
Has Child
TransformCheckHasChild checks whether a Transform has a child with a specific name.
| Parameter | Description |
|---|---|
| Transform | The Transform to check. |
| Child Name | Name to look for. |
| True Event / False Event | Events sent by the true/false result. |
Has Children
TransformCheckHasChildren checks whether a Transform has any children.
| Parameter | Description |
|---|---|
| Transform | The Transform to check. |
| True Event / False Event | Events sent by the true/false result. |
Get Child
TransformGetChild gets a child Transform by index.
| Parameter | Description |
|---|---|
| Transform | The parent Transform. |
| Child Index | Zero-based child index. |
| Get Child | Stores the child at that index, or None if the index is out of range. |
Get Random Child
TransformGetRandomChild returns one random child from a Transform.
| Parameter | Description |
|---|---|
| Transform | The parent Transform. |
| Child | Stores a randomly selected child, or None if there are no children. |
Get Children
TransformGetChildren gets all direct children of a Transform and stores them in a Transform List.
| Parameter | Description |
|---|---|
| Transform | The parent Transform. |
| Get Children | Stores all direct children in a list. |
Count Children
TransformCountChildren counts child Transforms and can include deeper descendants.
| Parameter | Description |
|---|---|
| Parent Transform | The Transform whose children you want to count. |
| Get Child Count | Stores the count result. |
| Recursive | If true, includes children of children throughout the hierarchy. |
For a direct child count only, use Unity's standard child count-based actions such as
TransformGetChildCount.
Detach Children
TransformDetachChildren removes all direct children from a Transform.
| Parameter | Description |
|---|---|
| Transform | The Transform whose children will be detached. |
Working With Siblings
Sibling actions are useful for menu ordering, UI stacking, and cycling through items under the same parent.
Get Next Sibling
TransformGetNextSibling gets the next sibling after the current Transform.
| Parameter | Description |
|---|---|
| Transform | The current Transform. |
| Skip Inactive | If true, ignores inactive sibling GameObjects. |
| Loop | If true, wraps back to the first valid sibling when it reaches the end. |
| Result | Stores the next sibling, or None if not found. |
| No Next Sibling | Optional event sent when no later sibling exists before looping. |
Get Previous Sibling
TransformGetPreviousSibling gets the previous sibling before the current Transform.
| Parameter | Description |
|---|---|
| Transform | The current Transform. |
| Skip Inactive | If true, ignores inactive sibling GameObjects. |
| Loop | If true, wraps back to the last valid sibling when it reaches the beginning. |
| Result | Stores the previous sibling, or None if not found. |
| No Previous Sibling | Optional event sent when no earlier sibling exists before looping. |
Get Sibling Index
TransformGetSiblingIndex gets the current sibling position of a Transform under its parent.
| Parameter | Description |
|---|---|
| Transform | The Transform to inspect. |
| Result | Stores the zero-based sibling index. |
Set Sibling Index
TransformSetSiblingIndex moves a Transform to a specific sibling position.
| Parameter | Description |
|---|---|
| Transform | The Transform to move. |
| Index | The new sibling index. |
Set As First Sibling
TransformSetAsFirstSibling moves a Transform to the start of its sibling list.
| Parameter | Description |
|---|---|
| Transform | The Transform to move. |
Set As Last Sibling
TransformSetAsLastSibling moves a Transform to the end of its sibling list.
| Parameter | Description |
|---|---|
| Transform | The Transform to move. |
Reparenting
Set Parent
TransformSetParent changes the parent of a Transform.
| Parameter | Description |
|---|---|
| Transform | The Transform to re-parent. |
| Set Parent | The new parent Transform. Leave empty to unparent it. |
Set Parent With World Position Option
TransformSetParent__WorldPosition changes the parent and lets you choose whether the object keeps its world-space position, rotation, and scale.
| Parameter | Description |
|---|---|
| Transform | The Transform to re-parent. |
| Parent | The new parent Transform. |
| World Position Stays | If true, keeps the current world-space transform values after re-parenting. |
Common Uses
- Find a named socket or bone higher in a rig using
TransformFindAncestor. - Pick a random spawn point from child Transforms using
TransformGetRandomChild. - Cycle through menu items using
TransformGetNextSiblingandTransformGetPreviousSibling. - Move a UI element to the front with
TransformSetAsLastSibling. - Re-parent an object while preserving its world position with
TransformSetParent__WorldPosition.