new SceneManager()
SceneManager is used to load and unload scenes. All scenes will automatically be added to SceneManager. Only the first scene will be loaded by default. To load a scene, use SceneManager.LoadScene(sceneId).
- Source
Methods
(static) CloseProject()
Close the in-memory project without touching persisted data.
- Source
(static) GetActiveScene() → {Scene}
Get the currently active scene.
- Source
The active scene.
- Type:
- Scene
(static) GetScene(id) → {Scene}
Get a scene by id.
| Name | Type | Description |
|---|---|---|
id | number | Id of the scene. |
- Source
The scene with the specified id.
- Type:
- Scene
(static) GetSceneByName(name) → {Scene}
Get a scene by name.
| Name | Type | Description |
|---|---|---|
name | string | Name of the scene. |
- Source
The scene with the specified name.
- Type:
- Scene
(static) GetScenes()
Return a snapshot of all registered scenes for project serialization.
- Source
(static) isSceneLoaded()
Whether a scene participates in the current main/additive runtime pass.
- Source
(static) LoadScene(id)
Load a scene by id. This will unload the current scene and load the new scene.
| Name | Type | Description |
|---|---|---|
id | number | Id of the scene to be loaded. |
- Source
(static) LoadSceneAdditive(id)
Load a new scene in additive mode. This will not unload the current scene.
| Name | Type | Description |
|---|---|---|
id | number | Id of the scene to be loaded. |
- Source
(async, static) OpenProject()
Reopen a saved project. Parsing is dynamic to retain the existing SceneLoader -> SceneManager dependency without introducing a module cycle.
- Source
(static) removeScene()
Remove a registered scene that is not currently active.
- Source
(static) replaceScene(scene) → {Scene}
Replace stale registrations that share a parsed scene's persisted ID. SceneLoader constructs and registers a Scene before restoring its ID from serialized data, so loading an edited scene again can otherwise leave duplicate IDs and make GetScene select the older instance.
| Name | Type | Description |
|---|---|---|
scene | Scene | The parsed replacement scene. |
- Source
The registered replacement scene.
- Type:
- Scene
(static) SerializeProject()
Build a versioned project payload from the currently registered scenes.
- Source
(static) TransitionToScene(id, entities)
Transition to another scene while moving selected runtime entities into it. Entity instances are transferred rather than serialized so their runtime state survives.
| Name | Type | Description |
|---|---|---|
id | number | Id of the destination scene. |
entities | Array.<Entity> | Entities to preserve across the transition. |
- Source
(static) UnloadAllAdditiveScenes()
Unload all added scenes. This will not unload the current scene.
- Source