Context.scenes.
Remarks
Scene changes asked throughctx.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(Defined in: modules/scene/src/scene.library.ts:57_options?):SceneLibrary
Parameters
_options?
SceneLibraryOptions = {}
Returns
SceneLibrary
Overrides
Library.constructor
Properties
key
Defined in: modules/scene/src/scene.library.ts:50 This library’s identity: its slot onreadonlykey:"scenes"
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():Defined in: modules/scene/src/scene.library.ts:99 Called once after the tick loop stops.Promise<void>
Returns
Promise<void>
Overrides
Library.__clear
__editorInit()
__editorInit(Defined in: modules/scene/src/scene.library.ts:69 Listens to the editor’s scene commands (live mode).ctx):Promise<void>
Parameters
ctx
EditorInitContext
Returns
Promise<void>
Implementation of
EditorAwareLibrary.__editorInit
__events()
__events(Defined in: modules/scene/src/scene.library.ts:89 Called every tick, in run order, whether or not the tick loop is paused — unlikectx):Promise<void>
__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():Defined in: modules/scene/src/scene.library.ts:61 Called once, in dependency order, before the tick loop starts.Promise<void>
Returns
Promise<void>
Overrides
Library.__init
__run()
__run(Defined in: modules/scene/src/scene.library.ts:94 Called every tick, in run order, while the tick loop is active and not paused.ctx):Promise<void>
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 — neverthis — 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()
Defined in: packages/common/dist/index.d.ts:536protectedthrowNotInitializedError():never
Returns
never
Inherited from
Library.throwNotInitializedError