Skip to content

API Class SceneManager

github-actions[bot] edited this page Nov 30, 2026 · 7 revisions

Class: SceneManager

Defined in: src/engine/scene/SceneManager.ts:34

Loads scene files as scene nodes under the World root (ADR 0016). Acts on the current World (ADR 0032): the one whose frame is running, else the Engine's default World. A load captures that World when called, so the swap lands there even though it happens later.

await SceneManager.load("scenes/level1.scene.json");
await SceneManager.load("scenes/hud.scene.json", { additive: true });

Constructors

Constructor

new SceneManager(): SceneManager;

Returns

SceneManager

Accessors

activeScene

Get Signature

get static activeScene(): GameObject | null;

Defined in: src/engine/scene/SceneManager.ts:36

The most recently loaded scene node.

Returns

GameObject | null


scenes

Get Signature

get static scenes(): GameObject[];

Defined in: src/engine/scene/SceneManager.ts:41

All loaded scene nodes, oldest first.

Returns

GameObject[]

Methods

load()

static load(path, options?): Promise<GameObject>;

Defined in: src/engine/scene/SceneManager.ts:49

Load a scene file. Assets are preloaded first; the swap happens at the end of the current frame (or immediately when the engine isn't mid-frame). Resolves with the new scene node.

Parameters

path

string

options?

LoadSceneOptions = {}

Returns

Promise<GameObject>


preload()

static preload(paths): Promise<void>;

Defined in: src/engine/scene/SceneManager.ts:101

Warm up prefabs and materials ahead of time (ADR 0080): their textures and models load, and the renderer draws each once, hidden, so the shader pipelines they need exist before they're spawned. For content chosen at runtime (a boss before its arena opens); scene loads already warm what their scene, its settings.preload list and the project's scripts name.

await SceneManager.preload(["prefabs/boss.prefab.json"]);

Parameters

paths

string[]

Returns

Promise<void>


unload()

static unload(scene): void;

Defined in: src/engine/scene/SceneManager.ts:109

Unload a scene node and everything in it (at the end of the frame).

Parameters

scene

GameObject

Returns

void

Clone this wiki locally