Beispiel #1
0
        public static Scene OpenScene(string path)
        {
            Scene scene = default(Scene);

            try
            {
                scene = EditorSceneManager.OpenScene(path + ".unity", OpenSceneMode.Additive);
                Fmarks.RestoreLastState(scene, true);
            }
            catch (System.Exception exception)
            {
                Debug.LogError(exception.Message);
            }

            return(scene);
        }
Beispiel #2
0
        public static void CloseScene(string path)
        {
            var name  = GetSceneNameFromPath(path);
            var scene = SceneManager.GetSceneByName(name);

            Fmarks.RestoreLastState(scene);

            if (scene.isDirty && !EditorApplication.isPlaying)
            {
                EditorSceneManager.SaveScene(scene);
            }

            if (scene.isLoaded)
            {
                EditorSceneManager.CloseScene(scene, true);
            }
        }