Version: 2017.1

SceneManager

class in UnityEngine.SceneManagement

切换到手册

描述

运行时的场景管理。

静态变量

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

静态函数

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 added scenes.
GetSceneByBuildIndexGet a scene struct from a build index.
GetSceneByNameSearches through the scenes added to the SceneManager for a scene with the given name.
GetSceneByPathSearches all scenes added to the SceneManager 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

activeSceneChangedAdd a delegate to this to get notifications 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
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961