UnityEngine.SceneManagement.SceneManager.GetSceneAt C# (CSharp) Method

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
        public static Scene GetSceneAt(int index)
        {
            Scene scene;
            INTERNAL_CALL_GetSceneAt(index, out scene);
            return scene;
        }

Usage Example

        /// <summary>
        /// 游戏框架组件初始化。
        /// </summary>
        protected override void Awake()
        {
            base.Awake();

            m_SceneManager = GameFrameworkEntry.GetModule <ISceneManager>();
            if (m_SceneManager == null)
            {
                Log.Fatal("Scene manager is invalid.");
                return;
            }

            m_SceneManager.LoadSceneSuccess         += OnLoadSceneSuccess;
            m_SceneManager.LoadSceneFailure         += OnLoadSceneFailure;
            m_SceneManager.LoadSceneUpdate          += OnLoadSceneUpdate;
            m_SceneManager.LoadSceneDependencyAsset += OnLoadSceneDependencyAsset;
            m_SceneManager.UnloadSceneSuccess       += OnUnloadSceneSuccess;
            m_SceneManager.UnloadSceneFailure       += OnUnloadSceneFailure;

            m_GameFrameworkScene = SceneManager.GetSceneAt(GameEntry.GameFrameworkSceneId);
            if (!m_GameFrameworkScene.IsValid())
            {
                Log.Fatal("Game Framework scene is invalid.");
                return;
            }
        }
All Usage Examples Of UnityEngine.SceneManagement.SceneManager::GetSceneAt