0
0
Unityframework~5 mins

Scene hierarchy window in Unity

Choose your learning style9 modes available
Introduction

The Scene hierarchy window shows all objects in your current scene. It helps you organize and find objects easily.

When you want to see all objects in your scene at once.
When you need to select or rename objects quickly.
When you want to organize objects into groups or parents.
When you want to check the structure of your scene.
When you want to drag objects to change their order or parent.
Syntax
Unity
No code syntax. It is a Unity Editor window showing a list/tree of GameObjects.
The window shows objects in a tree structure, showing parent-child relationships.
You can drag objects to reorder or nest them under other objects.
Examples
This shows a simple hierarchy with Player and Enemy objects having child objects nested under them.
Unity
Main Camera
Player
  Player Model
  Player Weapon
Enemy
  Enemy Model
  Enemy Weapon
Here, UI elements like Button and Text are children of the Canvas object.
Unity
UI Canvas
  Button
  Text
Background
Sample Program

This script creates a parent object and two child objects under it. You can see this structure in the Scene hierarchy window when you run the game.

Unity
using UnityEngine;

public class CreateObjects : MonoBehaviour
{
    void Start()
    {
        GameObject parent = new GameObject("ParentObject");
        GameObject child1 = new GameObject("Child1");
        GameObject child2 = new GameObject("Child2");

        child1.transform.parent = parent.transform;
        child2.transform.parent = parent.transform;

        Debug.Log("Created parent and two children in hierarchy.");
    }
}
OutputSuccess
Important Notes

You can rename objects by selecting them and pressing F2 or clicking their name.

Use the search bar at the top of the window to find objects by name.

Right-click objects to see options like delete, duplicate, or create empty child.

Summary

The Scene hierarchy window shows all objects in your scene in a tree view.

It helps organize objects by showing parent-child relationships.

You can select, rename, reorder, and group objects easily here.