SceneManager
Defined in: SceneManager.ts:28
Stack-based scene manager with push/pop/replace semantics.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SceneManager():
SceneManager
Returns
Section titled “Returns”SceneManager
Accessors
Section titled “Accessors”active
Section titled “active”Get Signature
Section titled “Get Signature”get active():
Scene|undefined
Defined in: SceneManager.ts:120
The topmost (active) scene.
Returns
Section titled “Returns”Scene | undefined
activeScenes
Section titled “activeScenes”Get Signature
Section titled “Get Signature”get activeScenes(): readonly
Scene[]
Defined in: SceneManager.ts:130
All non-paused scenes in the stack, bottom to top.
Returns
Section titled “Returns”readonly Scene[]
Get Signature
Section titled “Get Signature”get all(): readonly
Scene[]
Defined in: SceneManager.ts:125
All scenes in the stack, bottom to top.
Returns
Section titled “Returns”readonly Scene[]
autoPauseOnBlur
Section titled “autoPauseOnBlur”Get Signature
Section titled “Get Signature”get autoPauseOnBlur():
boolean
Defined in: SceneManager.ts:51
Pause all non-paused scenes when document.hidden becomes true; restore
them on focus. Default: false. Only scenes paused by this mechanism are
restored — user-paused scenes (manual scene.paused = true or pauseBelow
cascade) are never touched.
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set autoPauseOnBlur(
value):void
Defined in: SceneManager.ts:55
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
isTransitioning
Section titled “isTransitioning”Get Signature
Section titled “Get Signature”get isTransitioning():
boolean
Defined in: SceneManager.ts:135
Whether a scene transition is currently running.
Returns
Section titled “Returns”boolean
Methods
Section titled “Methods”_destroy()
Section titled “_destroy()”_destroy():
void
Defined in: SceneManager.ts:271
Internal
Mark the manager destroyed and synchronously tear down every scene. Called by Engine.destroy(). Any queued async work short-circuits on resume; in-flight transitions’ pending promises are resolved via _cleanupRun so they don’t leak.
Returns
Section titled “Returns”void
_flushDestroyQueues()
Section titled “_flushDestroyQueues()”_flushDestroyQueues():
void
Defined in: SceneManager.ts:297
Internal
Flush destroy queues for all active scenes. Called by the engine during endOfFrame.
Returns
Section titled “Returns”void
_handleVisibilityChange()
Section titled “_handleVisibilityChange()”_handleVisibilityChange(
hidden):void
Defined in: SceneManager.ts:95
Internal
React to a visibility change. Parameterised on hidden so unit tests can
drive it without a real document.
Parameters
Section titled “Parameters”hidden
Section titled “hidden”boolean
Returns
Section titled “Returns”void
_mountDetached()
Section titled “_mountDetached()”_mountDetached(
scene):Promise<void>
Defined in: SceneManager.ts:244
Internal
Run the full scene-enter lifecycle (beforeEnter hooks, preload, onEnter) for a scene that is NOT placed on the stack. Used by infrastructure plugins like DebugPlugin that render a scene off-stack.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
_setContext()
Section titled “_setContext()”_setContext(
context):void
Defined in: SceneManager.ts:70
Internal
Set the engine context.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”void
_tickTransition()
Section titled “_tickTransition()”_tickTransition(
dt):void
Defined in: SceneManager.ts:308
Internal
Advance the active transition by dt ms. Called by Engine’s earlyUpdate
callback with raw (unscaled) wall-clock dt.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
_unmountDetached()
Section titled “_unmountDetached()”_unmountDetached(
scene):void
Defined in: SceneManager.ts:258
Internal
Run the scene-exit lifecycle (onExit, entity destruction, afterExit hooks, scoped-service clear) for a detached scene.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
pop(
opts?):Promise<Scene|undefined>
Defined in: SceneManager.ts:164
Pop the top scene. Scenes below may receive onResume().
Safe to call reentrantly — see push.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<Scene | undefined>
popAll()
Section titled “popAll()”popAll():
Promise<void>
Defined in: SceneManager.ts:224
Pop every scene on the stack, top to bottom. Each receives onExit(). Queued like push/pop/replace — runs after any in-flight transition. Use for “restart from menu”-style flows. Does not run transitions.
Safe to call reentrantly — see push.
Returns
Section titled “Returns”Promise<void>
push()
Section titled “push()”push(
scene,opts?):Promise<void>
Defined in: SceneManager.ts:148
Push a scene onto the stack. Scenes below may receive onPause().
If the scene declares a preload array, assets are loaded before onEnter().
Safe to call reentrantly from a lifecycle hook (e.g. onEnter): the call
is queued on the internal pending chain and runs after the current
mutation finishes. The returned promise resolves once that deferred run
completes.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
replace()
Section titled “replace()”replace(
scene,opts?):Promise<void>
Defined in: SceneManager.ts:193
Replace the top scene. Without a transition the old scene exits first, then the new scene enters. With a transition the new scene is pushed first, both scenes coexist for the transition duration, then the old scene is removed at the end.
Safe to call reentrantly from a lifecycle hook (e.g. onEnter): the call
is queued on the internal pending chain and runs after the current
mutation finishes. The returned promise resolves once that deferred run
completes.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>