C# Class UnityEngine.SceneManagement.SceneManager

显示文件 Open project: CarlosHBC/UnityDecompiled Class Usage Examples

Public Methods

Method Description
CreateScene ( string sceneName ) : Scene

Create an empty new scene at runtime with the given name.

GetActiveScene ( ) : Scene

Gets the currently active scene.

GetSceneAt ( int index ) : Scene

Get the scene at index in the SceneManager's list of added scenes.

GetSceneByBuildIndex ( int buildIndex ) : Scene

Get a scene struct from a build index.

GetSceneByName ( string name ) : Scene

Searches through the scenes added to the SceneManager for a scene with the given name.

GetSceneByPath ( string scenePath ) : Scene

Searches all scenes added to the SceneManager for a scene that has the given asset path.

LoadScene ( int sceneBuildIndex, [ mode ) : void

Loads the scene by its name or index in Build Settings.

LoadScene ( string sceneName, [ mode ) : void

Loads the scene by its name or index in Build Settings.

LoadSceneAsync ( int sceneBuildIndex, [ mode ) : AsyncOperation

Loads the scene asynchronously in the background.

LoadSceneAsync ( string sceneName, [ mode ) : AsyncOperation

Loads the scene asynchronously in the background.

MergeScenes ( Scene sourceScene, Scene destinationScene ) : void

This will merge the source scene into the destinationScene. This function merges the contents of the source scene into the destination scene, and deletes the source scene. All GameObjects at the root of the source scene are moved to the root of the destination scene. NOTE: This function is destructive: The source scene will be destroyed once the merge has been completed.

MoveGameObjectToScene ( GameObject go, Scene scene ) : void

Move a GameObject from its current scene to a new Scene. You can only move root GameObjects from one Scene to another. This means the GameObject to move must not be a child of any other GameObject in its Scene.

SetActiveScene ( Scene scene ) : bool

Set the scene to be active.

UnloadSceneAsync ( Scene scene ) : AsyncOperation

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

UnloadSceneAsync ( int sceneBuildIndex ) : AsyncOperation

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

UnloadSceneAsync ( string sceneName ) : AsyncOperation

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

Private Methods

Method Description
GetAllScenes ( ) : UnityEngine.SceneManagement.Scene[]
INTERNAL_CALL_CreateScene ( string sceneName, Scene &value ) : void
INTERNAL_CALL_GetActiveScene ( Scene &value ) : void
INTERNAL_CALL_GetSceneAt ( int index, Scene &value ) : void
INTERNAL_CALL_GetSceneByBuildIndex ( int buildIndex, Scene &value ) : void
INTERNAL_CALL_GetSceneByName ( string name, Scene &value ) : void
INTERNAL_CALL_GetSceneByPath ( string scenePath, Scene &value ) : void
INTERNAL_CALL_MergeScenes ( Scene &sourceScene, Scene &destinationScene ) : void
INTERNAL_CALL_MoveGameObjectToScene ( GameObject go, Scene &scene ) : void
INTERNAL_CALL_SetActiveScene ( Scene &scene ) : bool
Internal_ActiveSceneChanged ( Scene previousActiveScene, Scene newActiveScene ) : void
Internal_SceneLoaded ( Scene scene, LoadSceneMode mode ) : void
Internal_SceneUnloaded ( Scene scene ) : void
LoadScene ( int sceneBuildIndex ) : void
LoadScene ( string sceneName ) : void
LoadSceneAsync ( int sceneBuildIndex ) : AsyncOperation
LoadSceneAsync ( string sceneName ) : AsyncOperation
LoadSceneAsyncNameIndexInternal ( string sceneName, int sceneBuildIndex, bool isAdditive, bool mustCompleteNextFrame ) : AsyncOperation
UnloadScene ( Scene scene ) : bool
UnloadScene ( int sceneBuildIndex ) : bool
UnloadScene ( string sceneName ) : bool
UnloadSceneNameIndexInternal ( string sceneName, int sceneBuildIndex, bool immediately, bool &outSuccess ) : AsyncOperation

Method Details

CreateScene() public static method

Create an empty new scene at runtime with the given name.

public static CreateScene ( string sceneName ) : Scene
sceneName string The name of the new scene. It cannot be empty or null, or same as the name of the existing scenes.
return Scene

GetActiveScene() public static method

Gets the currently active scene.

public static GetActiveScene ( ) : Scene
return Scene

GetSceneAt() public static method

Get the scene at index in the SceneManager's list of added scenes.

public static GetSceneAt ( int index ) : Scene
index int Index of the scene to get. Index must be greater than or equal to 0 and less than SceneManager.sceneCount.
return Scene

GetSceneByBuildIndex() public static method

Get a scene struct from a build index.

public static GetSceneByBuildIndex ( int buildIndex ) : Scene
buildIndex int Build index as shown in the Build Settings window.
return Scene

GetSceneByName() public static method

Searches through the scenes added to the SceneManager for a scene with the given name.

public static GetSceneByName ( string name ) : Scene
name string Name of scene to find.
return Scene

GetSceneByPath() public static method

Searches all scenes added to the SceneManager for a scene that has the given asset path.

public static GetSceneByPath ( string scenePath ) : Scene
scenePath string Path of the scene. Should be relative to the project folder. Like: "AssetsMyScenesMyScene.unity".
return Scene

LoadScene() public static method

Loads the scene by its name or index in Build Settings.

public static LoadScene ( int sceneBuildIndex, [ mode ) : void
sceneBuildIndex int Index of the scene in the Build Settings to load.
mode [ Allows you to specify whether or not to load the scene additively. /// See SceneManagement.LoadSceneMode for more information about the options.
return void

LoadScene() public static method

Loads the scene by its name or index in Build Settings.

public static LoadScene ( string sceneName, [ mode ) : void
sceneName string Name or path of the scene to load.
mode [ Allows you to specify whether or not to load the scene additively. /// See SceneManagement.LoadSceneMode for more information about the options.
return void

LoadSceneAsync() public static method

Loads the scene asynchronously in the background.

public static LoadSceneAsync ( int sceneBuildIndex, [ mode ) : AsyncOperation
sceneBuildIndex int Index of the scene in the Build Settings to load.
mode [ If LoadSceneMode.Single then all current scenes will be unloaded before loading.
return UnityEngine.AsyncOperation

LoadSceneAsync() public static method

Loads the scene asynchronously in the background.

public static LoadSceneAsync ( string sceneName, [ mode ) : AsyncOperation
sceneName string Name or path of the scene to load.
mode [ If LoadSceneMode.Single then all current scenes will be unloaded before loading.
return UnityEngine.AsyncOperation

MergeScenes() public static method

This will merge the source scene into the destinationScene. This function merges the contents of the source scene into the destination scene, and deletes the source scene. All GameObjects at the root of the source scene are moved to the root of the destination scene. NOTE: This function is destructive: The source scene will be destroyed once the merge has been completed.

public static MergeScenes ( Scene sourceScene, Scene destinationScene ) : void
sourceScene Scene The scene that will be merged into the destination scene.
destinationScene Scene Existing scene to merge the source scene into.
return void

MoveGameObjectToScene() public static method

Move a GameObject from its current scene to a new Scene. You can only move root GameObjects from one Scene to another. This means the GameObject to move must not be a child of any other GameObject in its Scene.

public static MoveGameObjectToScene ( GameObject go, Scene scene ) : void
go UnityEngine.GameObject GameObject to move.
scene Scene Scene to move into.
return void

SetActiveScene() public static method

Set the scene to be active.

public static SetActiveScene ( Scene scene ) : bool
scene Scene The scene to be set.
return bool

UnloadSceneAsync() public static method

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

public static UnloadSceneAsync ( Scene scene ) : AsyncOperation
scene Scene Scene to unload.
return UnityEngine.AsyncOperation

UnloadSceneAsync() public static method

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

public static UnloadSceneAsync ( int sceneBuildIndex ) : AsyncOperation
sceneBuildIndex int Index of the scene in BuildSettings.
return UnityEngine.AsyncOperation

UnloadSceneAsync() public static method

Destroyes all GameObjects associated with the given scene and removes the scene from the SceneManager.

public static UnloadSceneAsync ( string sceneName ) : AsyncOperation
sceneName string Name or path of the scene to unload.
return UnityEngine.AsyncOperation