Skip to main content
Defined in: modules/scene/src/scene.library.ts:49 The scene manager, exposed on Context.scenes.

Remarks

Scene changes asked through ctx.scenes are queued, and made when no system runs: before the tick’s systems (for changes asked outside of them, such as before app.run()) and right after them. The library runs after every other one for that. When the game stops, the loaded scenes and the vars are dropped without calling unload: the other libraries are cleared by then.

Example

Extends

  • Library

Implements

Constructors

Constructor

new SceneLibrary(_options?): SceneLibrary
Defined in: modules/scene/src/scene.library.ts:57

Parameters

_options?
SceneLibraryOptions = {}

Returns

SceneLibrary

Overrides

Library.constructor

Properties

key

readonly key: "scenes"
Defined in: modules/scene/src/scene.library.ts:50 This library’s identity: its slot on Context, its registry key, and the identifier used to reference it in ordering relationships.

Overrides

Library.key

Accessors

manager

Get Signature

get manager(): SceneManager
Defined in: modules/scene/src/scene.library.ts:122 The scene manager.
Returns
SceneManager

relationships

Get Signature

get relationships(): LibraryRelationships
Defined in: packages/common/dist/index.d.ts:512 Internal
Returns
LibraryRelationships

Inherited from

Library.relationships

Methods

__clear()

__clear(): Promise<void>
Defined in: modules/scene/src/scene.library.ts:99 Called once after the tick loop stops.

Returns

Promise<void>

Overrides

Library.__clear

__editorInit()

__editorInit(ctx): Promise<void>
Defined in: modules/scene/src/scene.library.ts:69 Listens to the editor’s scene commands (live mode).

Parameters

ctx
EditorInitContext

Returns

Promise<void>

Implementation of

EditorAwareLibrary.__editorInit

__events()

__events(ctx): Promise<void>
Defined in: modules/scene/src/scene.library.ts:89 Called every tick, in run order, whether or not the tick loop is paused — unlike __run. Use this for event/message draining that must not be affected by pause (e.g. listening for the command that resumes the loop), not for gameplay simulation.

Parameters

ctx
Context

Returns

Promise<void>

Overrides

Library.__events

__init()

__init(): Promise<void>
Defined in: modules/scene/src/scene.library.ts:61 Called once, in dependency order, before the tick loop starts.

Returns

Promise<void>

Overrides

Library.__init

__run()

__run(ctx): Promise<void>
Defined in: modules/scene/src/scene.library.ts:94 Called every tick, in run order, while the tick loop is active and not paused.

Parameters

ctx
Context

Returns

Promise<void>

Overrides

Library.__run

editorScenes()

editorScenes(): EditorScenes
Defined in: modules/scene/src/scene.library.ts:104 The loaded scenes and the vars, as the editor’s scenes event carries them.

Returns

EditorScenes

expose()

expose(): ScenesContextApi
Defined in: modules/scene/src/scene.library.ts:127 Returns this library’s public contribution to Context[this.key].

Returns

ScenesContextApi

Remarks

Return a plain object exposing only what game code should be able to reach — never this — so internal state and lifecycle hooks never leak onto Context. Libraries with nothing to expose (headless libraries) can leave this unimplemented; they simply won’t appear on Context.

Overrides

Library.expose

throwNotInitializedError()

protected throwNotInitializedError(): never
Defined in: packages/common/dist/index.d.ts:536

Returns

never

Inherited from

Library.throwNotInitializedError