Version: 2023.2
LanguageEnglish
  • C#

Hierarchy

class in Unity.Hierarchy

/

Implemented in:UnityEngine.HierarchyCoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Represents a tree-like container of nodes.

Properties

Count The total number of nodes.
IsCreated Whether or not this object is valid and uses memory.
Root The root node.
UpdateNeeded Whether the hierarchy requires an update.
Updating Whether the hierarchy is currently updating.

Constructors

Hierarchy Constructs a new Hierarchy.

Public Methods

Add Adds a new node that has a specified parent node to the hierarchy.
Clear Removes all nodes from the hierarchy.
Dispose Dispose this object to release its memory.
DoesChildrenNeedsSorting Gets whether the child nodes of a hierarchy node need to be sorted.
EnumerateChildren Gets the child nodes of a hierarchy node.
Exists Determines whether a node exists or not.
GetAllNodeTypeHandlersBase Gets all the node type handlers that this hierarchy uses.
GetChild Gets the child node at the specified index of a hierarchy node.
GetChildren Gets the child nodes of a hierarchy node.
GetChildrenCount Gets the number of child nodes that a hierarchy node has.
GetChildrenCountRecursive Gets the number of child nodes that a hierarchy node has, including children of children.
GetDepth Determines the depth of a node.
GetName Gets the name of a hierarchy node.
GetNextSibling Gets the next sibling of a node.
GetNodeType Gets the type of the specified hierarchy node.
GetNodeTypeHandlerBase Gets a hierarchy node type handler instance from this hierarchy.
GetOrCreatePropertyString Creates a string property with a specified name.
GetOrCreatePropertyUnmanaged Creates an unmanaged property with a specified name.
GetParent Gets the parent of a hierarchy node.
GetSortIndex Gets the sorting index of a hierarchy node.
RegisterNodeTypeHandler Registers a hierarchy node type handler for this hierarchy.
Remove Removes a node from the hierarchy.
RemoveChildren Recursively removes all children of a node.
Reserve Reserves memory for nodes to use. Use this to avoid memory allocation hits when you add batches of nodes.
SetName Sets the name of a hierarchy node.
SetParent Sets the parent of a hierarchy node.
SetSortIndex Sets the sorting index of a hierarchy node.
SortChildren Sorts the child nodes of a hierarchy node according to their sort index.
UnregisterNodeTypeHandler Removes a hierarchy node type handler from this hierarchy.
Update Updates the hierarchy and requests that every registered hierarchy node type handler integrates their changes into the hierarchy.
UpdateIncremental Updates the hierarchy incrementally.
UpdateIncrementalTimed Incrementally updates the hierarchy until a time limit is reached.