Scenes and scene nodes

Scenes

A scene is a tree of nodes that represents something in your game — a level, a menu, a character, a UI screen. Everything you see in your game lives inside a scene.

Scenes are saved as .prefab files in the project's assets/ folder. The format is human-readable JSON designed for version control:

assets/
  scene-01.prefab       ← one scene
  player-scene.prefab   ← another scene
  enemies/
    grunt.prefab
    boss.prefab

The boot scene is the first scene loaded when your game starts. It is set in Project Settings.

Nodes (game objects)

A node (also called a game object) is a single element inside a scene. Nodes are organised in a tree: each node has exactly one parent and any number of children. This parent-child hierarchy is fundamental — transforming a parent (position, rotation, scale) automatically transforms its children.

Scene root
├── Camera
│   └── DirectionalLight (child of Camera — follows it)
├── Ground
│   ├── Tree (child of Ground — moves with it)
│   └── Rock
└── Player
    └── Weapon

Every node has a Transform component — position, rotation, and scale in 3D space. Even an empty node with only a Transform is useful: it can act as a mounting point, a spawn location, or a grouping parent.

Working with nodes in the editor

In the Scene Hierarchy panel you can:

  • Select a node to inspect and edit its components.
  • Create a new empty node via Scene → Add Empty Object.
  • Reparent by dragging a node onto another in the hierarchy.
  • Reorder siblings by dragging up and down.
  • Duplicate or delete via right-click context menu.

To add components to a selected node, use the Add Component ▾ button in the Inspector.

The scene file on disk

A .prefab file stores the entire node tree as structured JSON. It is human-readable and diff-friendly:

{
    "name": "MyScene",
    "nodes": [
        {
            "name": "Camera",
            "transform": { "position": { "x": 0, "y": 5, "z": 10 } },
            "components": [ /* ... component data ... */ ]
        },
        {
            "name": "Ground",
            "transform": { "scale": { "x": 10, "y": 1, "z": 10 } },
            "children": [
                { "name": "Tree", "transform": { "position": { "x": 2, "y": 0, "z": -3 } } }
            ]
        }
    ]
}

You rarely need to hand-edit .prefab scene files — the editor handles it — but the format makes it easy to review changes in Git, resolve merge conflicts, or script bulk-edits.


← All docs Edit this page