# Hierarchy

> Represents a tree-like container of nodes.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Hierarchy](/engine/6000.3/script-reference/unity/hierarchy.md)
* **Assembly:** UnityEngine.HierarchyCoreModule
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public sealed class Hierarchy : IDisposable
```

## Constructors

| Constructor                                                                      | Description                                                                                 |
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [Hierarchy()](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/ctor.md) | Constructs a new [Hierarchy](/engine/6000.3/script-reference/unity/hierarchy/hierarchy.md). |

## Properties

| Property                                                                                  | Description                                          |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [Count](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/count.md)               | The total number of nodes.                           |
| [IsCreated](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/iscreated.md)       | Whether or not this object is valid and uses memory. |
| [Root](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/root.md)                 | The root node.                                       |
| [UpdateNeeded](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/updateneeded.md) | Whether the hierarchy requires an update.            |
| [Updating](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/updating.md)         | Whether the hierarchy is currently updating.         |

## Methods

| Method                                                                                                                      | Description                                                                                                       |
| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [Add](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/add.md)                                                     | Adds a new node that has a specified parent node to the hierarchy.                                                |
| [Clear](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/clear.md)                                                 | Removes all nodes from the hierarchy.                                                                             |
| [Dispose](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/dispose.md)                                             | Dispose this object to release its memory.                                                                        |
| [DoesChildrenNeedsSorting](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/doeschildrenneedssorting.md)           | Gets whether the child nodes of a hierarchy node need to be sorted.                                               |
| [EnumerateChildren](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/enumeratechildren.md)                         | Gets the child nodes of a hierarchy node.                                                                         |
| [EnumerateNodeTypeHandlersBase](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/enumeratenodetypehandlersbase.md) | Enumerates all the node type handlers base that this hierarchy uses.                                              |
| [Exists](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/exists.md)                                               | Determines whether a node exists or not.                                                                          |
| [GetChild](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getchild.md)                                           | Gets the child node at the specified index of a hierarchy node.                                                   |
| [GetChildIndex](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getchildindex.md)                                 | Gets the index of a hierarchy node in its parent's children list.                                                 |
| [GetChildren](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getchildren.md)                                     | Gets the child nodes of a hierarchy node.                                                                         |
| [GetChildrenCount](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getchildrencount.md)                           | Gets the number of child nodes that a hierarchy node has.                                                         |
| [GetChildrenCountRecursive](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getchildrencountrecursive.md)         | Gets the number of child nodes that a hierarchy node has, including children of children.                         |
| [GetDepth](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getdepth.md)                                           | Determines the depth of a node.                                                                                   |
| [GetHashCode](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/gethashcode.md)                                     | Gets the hash code for the specified hierarchy node.                                                              |
| [GetName](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getname.md)                                             | Gets the name of a hierarchy node.                                                                                |
| [GetNextSibling](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getnextsibling.md)                               | Gets the next sibling of a node.                                                                                  |
| [GetNodeType](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getnodetype.md)                                     | Retrieve the hierarchy node type for the specified node.                                                          |
| [GetNodeTypeHandlerBase](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getnodetypehandlerbase.md)               | Gets the node type handler instance for the specified node type name from this hierarchy.                         |
| [GetOrCreateNodeTypeHandler](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getorcreatenodetypehandler.md)       | Get or create a hierarchy node type handler instance for this hierarchy.                                          |
| [GetOrCreatePropertyString](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getorcreatepropertystring.md)         | Creates a string property with a specified name.                                                                  |
| [GetOrCreatePropertyUnmanaged](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getorcreatepropertyunmanaged.md)   | Creates an unmanaged property with a specified name.                                                              |
| [GetParent](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getparent.md)                                         | Gets the parent of a hierarchy node.                                                                              |
| [GetPath](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getpath.md)                                             | Gets the path of a hierarchy node.                                                                                |
| [GetSortIndex](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/getsortindex.md)                                   | Gets the sort index of a hierarchy node. Default is 0.                                                            |
| [Remove](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/remove.md)                                               | Removes a node from the hierarchy.                                                                                |
| [RemoveChildren](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/removechildren.md)                               | Recursively removes all children of a node.                                                                       |
| [Reserve](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/reserve.md)                                             | Ensures that the hierarchy has enough memory reserved for storing the specified number of nodes.                  |
| [ReserveChildren](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/reservechildren.md)                             | Ensures that the hierarchy node has enough memory reserved for storing the specified number of children nodes.    |
| [SetChildrenNeedsSorting](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/setchildrenneedssorting.md)             | Marks a hierarchy node as requiring sorting of its children in the next sorting operation.                        |
| [SetDirty](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/setdirty.md)                                           | Force an update of the hierarchy, even if no changes are pending.                                                 |
| [SetName](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/setname.md)                                             | Sets the name of a hierarchy node.                                                                                |
| [SetParent](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/setparent.md)                                         | Sets the parent of a hierarchy node.                                                                              |
| [SetSortIndex](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/setsortindex.md)                                   | Sets the sort index of a hierarchy node.                                                                          |
| [SortChildren](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/sortchildren.md)                                   | Sorts the child nodes of a hierarchy node according to their sort index.                                          |
| [SortChildrenRecursive](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/sortchildrenrecursive.md)                 | Sorts the child nodes of a hierarchy node according to their sort index.                                          |
| [Update](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/update.md)                                               | Updates the hierarchy, executing all pending changes in the command list.                                         |
| [UpdateIncremental](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/updateincremental.md)                         | Updates the hierarchy incrementally, executing one pending change in the command list.                            |
| [UpdateIncrementalTimed](/engine/6000.3/script-reference/unity/hierarchy/hierarchy/updateincrementaltimed.md)               | Updates the hierarchy incrementally, executing pending changes in the command list until a time limit is reached. |
