liveBook · Manning

Unity scene

As explained in High Performance Unity Game Development

A Unity asset that contains a collection of scene objects, environment settings, and other state used to construct a playable or editable portion of a game.

A Unity scene holds objects such as the Camera and GameObjects. In a data-oriented architecture, using one scene can keep game state under the game’s direct control instead of dividing it across scene loads. section 5.1.4 section 5.5

Consider whether a game difference needs a separate scene or can be represented as data:

  • Treat levels as data: store enemy spawns, background, music, and win or lose conditions, then load the chosen level’s values. section 5.1.4
  • Treat menus as data and UI: change the menu state and show or hide the relevant UI GameObjects. section 5.1.4
  • Keep game flow in Game and current state in GameData; let the game loop use that data to drive the scene’s objects. section 5.1.4

Switching levels

To play a different level, load different level data rather than loading another Unity scene. This avoids managing which scene is active, which objects persist, and how state moves between scenes. section 5.1.4

How High Performance Unity Game Development covers it

How deep it goes
Explains the architectural trade-off and scene-state costs without detailing scene-loading implementation.
Examples
Contrasts separate scenes for levels and menus with loading level data and toggling menu GameObjects.
What you can do after
Evaluate whether levels or menus need separate scenes by representing their differences as data and changing game state.
How it connects
Connects Unity scenes to data-oriented design, game state, and the game loop.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of High Performance Unity Game Development. The section links point to the parts of the book it draws on.