Editor/LevelsTools.cs
/// <summary>
/// Passively loads all scene from level into editor without changing EditorState
/// </summary>
Passively loads all scene from level into editor without changing EditorState
Passively loads all scene from level into editor without changing EditorState
[MenuItem("Assets/OpenLevel (editor)")]
        static void LoadLevel()
        {
            InitializeLevels();
            CollectLevelsInDatabase();
            var selected = Selection.activeObject;
            if (selected == null)
            {
                Debug.Log("Select level first.");
                return;
            }
            Type t = selected.GetType();
            if (t != typeof(Level))
            {
                Debug.LogError("Select Level!");
                return;
            }
            selectedLevel = (Level)selected;
            EditorSceneManager.SaveOpenScenes();
            Scene n = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
            LoadLevelEditor(selectedLevel);
            EditorSceneManager.CloseScene(n, true);
        }
[ MenuItem ( " " ) ] static void LoadLevel ( ) { InitializeLevels ( ) ; CollectLevelsInDatabase ( ) ; var selected = Selection . activeObject ; if ( selected == null ) { Debug . Log ( " " ) ; return ; } Type t = selected . GetType ( ) ; if ( t != typeof ( Level ) ) { Debug . LogError ( " " ) ; return ; } selectedLevel = ( Level ) selected ; EditorSceneManager . SaveOpenScenes ( ) ; Scene n = EditorSceneManager . NewScene ( NewSceneSetup . EmptyScene , NewSceneMode . Single ) ; LoadLevelEditor ( selectedLevel ) ; EditorSceneManager . CloseScene ( n , true ) ; }
Passively loads all scene from level into editor without changing EditorState
Passively loads all scene from level into editor without changing EditorState
//get selection //Trick to clear all currently opened scenes is to just make new one