SceneManager

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).

Methods

(static) CloseProject()

Close the in-memory project without touching persisted data.

(static) GetActiveScene() → {Scene}

Get the currently active scene.

Returns:

The active scene.

Type: 
Scene

(static) GetScene(id) → {Scene}

Get a scene by id.

Parameters:
NameTypeDescription
idnumber

Id of the scene.

Returns:

The scene with the specified id.

Type: 
Scene

(static) GetSceneByName(name) → {Scene}

Get a scene by name.

Parameters:
NameTypeDescription
namestring

Name of the scene.

Returns:

The scene with the specified name.

Type: 
Scene

(static) GetScenes()

Return a snapshot of all registered scenes for project serialization.

(static) isSceneLoaded()

Whether a scene participates in the current main/additive runtime pass.

(static) LoadScene(id)

Load a scene by id. This will unload the current scene and load the new scene.

Parameters:
NameTypeDescription
idnumber

Id of the scene to be loaded.

(static) LoadSceneAdditive(id)

Load a new scene in additive mode. This will not unload the current scene.

Parameters:
NameTypeDescription
idnumber

Id of the scene to be loaded.

(async, static) OpenProject()

Reopen a saved project. Parsing is dynamic to retain the existing SceneLoader -> SceneManager dependency without introducing a module cycle.

(static) removeScene()

Remove a registered scene that is not currently active.

(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.

Parameters:
NameTypeDescription
sceneScene

The parsed replacement scene.

Returns:

The registered replacement scene.

Type: 
Scene

(static) SerializeProject()

Build a versioned project payload from the currently registered scenes.

(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.

Parameters:
NameTypeDescription
idnumber

Id of the destination scene.

entitiesArray.<Entity>

Entities to preserve across the transition.

(static) UnloadAllAdditiveScenes()

Unload all added scenes. This will not unload the current scene.