Scenes and GameObjects
↑How it works and why
Section titled “How it works and why”A scene is a saved composition of GameObjects. A GameObject is a container for components; the components provide behavior or data such as a Transform, a MeshRenderer, a Collider or your MonoBehaviour. A GameObject by itself does not render a model or simulate physics. The Transform expresses its position, rotation and scale.
Use several scenes when you want clear loading boundaries (menu, level, results), not because each prefab needs a separate scene. An additive scene lets you keep multiple scenes loaded at once, useful for shared lighting or large worlds.
Example you can try
Section titled “Example you can try”using UnityEngine;using UnityEngine.SceneManagement;
public sealed class LevelLoader : MonoBehaviour{ // The scene must be included in the active build profile. public void StartGame() => SceneManager.LoadScene("Game");}When to use it and what can go wrong
Section titled “When to use it and what can go wrong”When to use it: Separate boot/menu/game scenes when they have different lifetimes. Put reusable entities in prefabs. Pitfall: A scene name that works in the Editor can fail in a build if that scene was not included. Avoid hard-coded scene indices when reordering build scenes.
Try it: Create a Menu and Game scene, add both to the build’s scene list and use a UI Button to call StartGame().
