Version: 2018.2

EditorSceneManager

class in UnityEditor.SceneManagement

/

Inherits from:SceneManagement.SceneManager

Switch to Manual

Description

Scene management in the Editor.

Static Variables

loadedSceneCountThe number of loaded Scenes.
playModeStartSceneLoads this SceneAsset when you start Play Mode.
preventCrossSceneReferencesControls whether cross-Scene references are allowed in the Editor.

Static Functions

ClosePreviewSceneCloses a preview scene created by NewPreviewScene.
CloseSceneClose the Scene. If removeScene flag is true, the closed Scene will also be removed from EditorSceneManager.
DetectCrossSceneReferencesDetects cross-scene references in a Scene.
EnsureUntitledSceneHasBeenSavedShows a save dialog if an Untitled scene exists in the current scene manager setup.
GetSceneManagerSetupReturns the current setup of the SceneManager.
MarkAllScenesDirtyMark all the loaded Scenes as modified.
MarkSceneDirtyMark the specified Scene as modified.
MoveSceneAfterAllows you to reorder the Scenes currently open in the Hierarchy window. Moves the source Scene so it comes after the destination Scene.
MoveSceneBeforeAllows you to reorder the Scenes currently open in the Hierarchy window. Moves the source Scene so it comes before the destination Scene.
NewPreviewSceneCreates a new preview scene. Any object added to a preview scene will only be rendered in that scene.
NewSceneСоздает новую сцену.
OpenSceneOpen a Scene in the Editor.
RestoreSceneManagerSetupRestore the setup of the SceneManager.
SaveCurrentModifiedScenesIfUserWantsToAsks you if you want to save the modified Scene or Scenes.
SaveModifiedScenesIfUserWantsToAsks whether the modfied input Scenes should be saved.
SaveOpenScenesСоздает новую сцену.
SaveSceneСоздает новую сцену.
SaveScenesSave a list of Scenes.

Events

activeSceneChangedInEditModeSubscribe to this event to get notified when the active Scene has changed in Edit mode in the Editor.
newSceneCreatedThis event is called after a new Scene has been created.
sceneClosedThis event is called after a Scene has been closed in the editor.
sceneClosingThis event is called before closing an open Scene after you have requested that the Scene is closed.
sceneOpenedThis event is called after a Scene has been opened in the editor.
sceneOpeningThis event is called before opening an existing Scene.
sceneSavedThis event is called after a Scene has been saved.
sceneSavingThis event is called before a Scene is saved disk after you have requested the Scene to be saved.

Delegates

NewSceneCreatedCallbackCallbacks of this type which have been added to the newSceneCreated event are called after a new Scene has been created.
SceneClosedCallbackCallbacks of this type which have been added to the sceneClosed event are called immediately after the Scene has been closed.
SceneClosingCallbackCallbacks of this type which have been added to the sceneClosing event are called just before a Scene is closed.
SceneOpenedCallbackCallbacks of this type which have been added to the sceneOpened event are called after a Scene has been opened.
SceneOpeningCallbackCallbacks of this type which have been added to the sceneOpening event are called just before opening a Scene.
SceneSavedCallbackCallbacks of this type which have been added to the sceneSaved event are called after a Scene has been saved.
SceneSavingCallbackCallbacks of this type which have been added to the sceneSaving event are called just before the Scene is saved.

Inherited members

Static Variables

sceneCountThe total number of currently loaded Scenes.
sceneCountInBuildSettingsNumber of Scenes in Build Settings.

Static Functions

CreateSceneCreate an empty new Scene at runtime with the given name.
GetActiveSceneGets the currently active Scene.
GetSceneAtGet the Scene at index in the SceneManager's list of loaded Scenes.
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.
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.

Events

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