예제 #1
0
        static void End()
        {
            var scene = EditorSceneManager.GetSceneByName(string.Empty);

            if (scene.isLoaded == false)
            {
                return;
            }

            var audioSource = FindAudioSource(scene);

            if (audioSource != null)
            {
                if (scene.rootCount == 1 && EditorSceneManager.loadedSceneCount > 1)
                {
#pragma warning disable CS0618
                    EditorSceneManager.UnloadScene(scene);
#pragma warning restore CS0618
                }
                else
                {
                    GameObject.DestroyImmediate(audioSource.gameObject);
                }
            }
        }
예제 #2
0
        void DrawScene(bool show, SimpleUISceneType asset)
        {
            //Debug.Log("DRAW SCENE " + asset.AssetPath);

            var scene = SceneManager.GetSceneByPath(asset.AssetPath);

            var sceneName  = scene.name;
            var buildIndex = scene.buildIndex;

            if (show)
            {
                if (!scene.isLoaded)
                {
                    EditorSceneManager.LoadScene(buildIndex, LoadSceneMode.Additive);
                    SceneManager.LoadScene(buildIndex, LoadSceneMode.Additive);

                    EditorSceneManager.SetActiveScene(scene);
                }
            }
            else
            {
                if (scene.isLoaded)
                {
                    EditorSceneManager.UnloadScene(buildIndex);
                    SceneManager.UnloadScene(buildIndex);
                    //SceneManager.LoadScene(buildIndex, LoadSceneMode.Additive);
                }
            }
        }
예제 #3
0
    private static void OnAfterLaunch()
    {
        var hasInitScene = EditorPrefs.GetBool(HasInitScene);

        if (hasInitScene == false)
        {
            return;
        }

        var editingSceneName = EditorPrefs.GetString(EditingSceneName);

        EditorSceneManager.UnloadScene(editingSceneName);
    }