Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SceneManager

Scene management at run-time.
Read time 1 minuteLast updated 6 days ago

Definition

public class SceneManager

Static Properties

Property

Description

loadedSceneCountThe number of loaded Scenes.
sceneCountThe current number of Scenes.
sceneCountInBuildSettingsNumber of Scenes in Build Settings.

Static Methods

Method

Description

CreateSceneCreate an empty new Scene at runtime with the given name.
GetActiveSceneGets the currently active Scene.
GetSceneAtGets the scene at the specified index in the SceneManager's scene list. This includes scenes that are currently loading or unloading.
GetSceneByBuildIndexGet a Scene struct from a build index.
GetSceneByNameSearches through the Scenes loaded for a Scene with the given name.
GetSceneByPathSearches all Scenes loaded for a Scene that has the given asset path.
LoadSceneLoads the Scene by its name or index in Build Settings.
LoadSceneAsyncLoads the Scene asynchronously in the background.
MergeScenesThis will merge the source Scene into the destinationScene.
MoveGameObjectsToSceneMove multiple GameObjects, represented by a NativeArray of instance IDs, from their current Scene to a new Scene.
MoveGameObjectToSceneMove a GameObject from its current Scene to a new Scene.
SetActiveSceneSet the Scene to be active.
UnloadSceneAsyncDestroys all GameObjects associated with the given Scene and removes the Scene from the SceneManager.

Static Events

Member

Description

activeSceneChangedSubscribe to this event to get notified when the active Scene has changed.
sceneLoadedAssign a custom callback to this event to get notifications when a Scene has loaded.
sceneUnloadedAdd a delegate to this to get notifications when a Scene has unloaded.