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

UnloadScene() private method

private UnloadScene ( Scene scene ) : bool
scene Scene
return bool
        public static bool UnloadScene(Scene scene)
        {
            bool flag;
            UnloadSceneNameIndexInternal("", scene.buildIndex, true, out flag);
            return flag;
        }

Same methods

SceneManager::UnloadScene ( int sceneBuildIndex ) : bool
SceneManager::UnloadScene ( string sceneName ) : bool

Usage Example

コード例 #1
0
ファイル: SceneManager.cs プロジェクト: WangWeiNing/MateUnity
        /// <summary>
        /// Unload a scene loaded via AddScene
        /// </summary>
        public void UnloadAddedScene(string sceneName)
        {
            for (int i = 0; i < mScenesAdded.Count; i++)
            {
                if (mScenesAdded[i].name == sceneName)
                {
                    mScenesAdded.RemoveAt(i);
                    UnitySceneManager.UnloadScene(sceneName);
                    return;
                }
            }

            //check the queue
            if (mScenesToAdd.Contains(sceneName))
            {
                //reconstruct the queue excluding the sceneName
                var newSceneQueue = new Queue <string>();
                while (mScenesToAdd.Count > 0)
                {
                    var s = mScenesToAdd.Dequeue();
                    if (s != sceneName)
                    {
                        newSceneQueue.Enqueue(s);
                    }
                }
                mScenesToAdd = newSceneQueue;
            }
        }
All Usage Examples Of UnityEngine.SceneManagement.SceneManager::UnloadScene