Unity Hierarchy is the central window in the Unity Editor where you can see and manage all the objects in your scene. It provides a visual representation of the scene's structure and allows you to manipulate objects, components, and assets.

Key Concepts

  • Transform: The Transform component is the core of every GameObject. It contains the position, rotation, and scale of the object.
  • GameObject: A GameObject is the base class for all objects in Unity. It can have components attached to it, such as Transform, Mesh Renderer, and Script.
  • Component: A Component is a class that adds a specific functionality to a GameObject. Examples include Mesh Renderer, Script, and Camera.

Hierarchy Structure

The Hierarchy is organized in a tree-like structure, with the root GameObject at the top. Each GameObject can have children, and you can create and delete GameObjects as needed.

Example Hierarchy

Root GameObject
├── Cube
│   ├── Mesh Renderer
│   └── Box Collider
└── Sphere
    ├── Mesh Renderer
    └── Sphere Collider

In this example, the Cube and Sphere are children of the Root GameObject. The Cube has a Mesh Renderer and a Box Collider, while the Sphere has a Mesh Renderer and a Sphere Collider.

Navigating the Hierarchy

  • Selecting GameObjects: Click on a GameObject in the Hierarchy to select it. You can also use keyboard shortcuts, such as S to select the next GameObject or Shift + S to select the previous GameObject.
  • Dragging GameObjects: Drag and drop GameObjects to reorganize them in the Hierarchy.
  • Renaming GameObjects: Double-click on a GameObject's name to rename it.

Useful Links

Unity Hierarchy Example