Game Development
Additive loading
Learn to layer scenes with LoadSceneMode.Additive.
Additive Scene Loading
In large game architectures, partitioning content across multiple scenes is cleaner than cramming everything into one file. Using LoadSceneMode.Additive preserves the active scene, layering the new scene on top like an overlay.
using UnityEngine.SceneManagement;
// Loading a UI scene additively on top of gameplay
SceneManager.LoadScene("UIScene", LoadSceneMode.Additive);
This allows a 3D gameplay world and an independent UI canvas scene to coexist simultaneously.
Multi-Scene Architecture and UnloadSceneAsync
In multi-scene setups, unloading secondary scenes that are no longer needed is executed via SceneManager.UnloadSceneAsync(). For instance, closing an inventory screen unloads the inventory scene.
// Purging the secondary UI scene from memory
SceneManager.UnloadSceneAsync("UIScene");
This technique enables open-world games to stream zones in and out dynamically in the background.
Exercise Print base and additive scene info
Assign "World" to baseScene and "UIOverlay" to overlayScene. Print Base: World + Additive: UIOverlay to the console.
Show example solution
using System;
class Program
{
static void Main()
{
string baseScene = "World";
string overlayScene = "UIOverlay";
Console.WriteLine("Base: " + baseScene + " + Additive: " + overlayScene);
}
}
Test yourself
-
What happens to the currently active scene when a new scene is loaded with LoadSceneMode.Additive?
- The current scene remains loaded; the new scene is appended alongside/on top of it
- Camera output turns completely black and audio cuts out
- All objects in the current scene are purged from memory and disk
- The game engine crashes and the editor closes
Show answer
The current scene remains loaded; the new scene is appended alongside/on top of it — Additive mode does not close current scenes; it binds the incoming scene as an additional layer alongside them.
-
Select additive loading mode
SceneManager.LoadScene("InventoryUI", LoadSceneMode.____);
Show answer
SceneManager.LoadScene("InventoryUI", LoadSceneMode.Additive);
-
Additive scene concepts
- LoadSceneMode.Additive
- Adds scene without closing the current
- UnloadSceneAsync
- Unloads an added scene from memory
- Multi-scene
- Game split into multiple scene layers
- UI Overlay
- Independent UI layered over game world
Next lesson: DontDestroyOnLoad