Introduction to Hierarchy in Unity

Notes:

Introduction to Hierarchy of Objects in Unity :
Each game object in Unity is managed by a Hierarchical / tree data structure.

A
--B
--C
----D
----E
----F

G
--H
----I
----J
--K
----L

Tree terminologies:
Tree:
A data structure, in which objects are organized in hierarchical structure (I.e. in levels)
Hierarchy means levels
Tree is represented based on parent & child relationship present between objects.

Root:
An object in top most level of the tree that does not have a parent
All root objects can be parent

Parent:
An object containing one or more child objects (i.e. children)

Child:
An object that has a parent object

Siblings (brothers or sisters):
Two or more objects with same parent

Leaf:
An object without child object or children

Descendants / Successors:
Any objects falling under the selected object
(I.e. Direct Children, Children’s Children, or any object that can be reachable from the selected object up to the leaf object is considered as descendant)

Ancestors / Predecessors:
Any objects visited in the path from the selected object to the root object.
(I.e. Parent, Grandparent, Grand grandparent, or any object visited up from the selected object to the root object are considered as ancestors)

Benefits of Tree data structure:
Allows us to efficiently
- store and manage data / objects in levels
- search and manipulate data
- move sub trees
- inherit some properties of a parent to its descendents