1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- using System.IO;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class RunFromMain : EditorWindow
- {
- //================================================================================
- //
- //================================================================================
- [MenuItem ("Run/Run from first scene _%#r")]
- static void Run()
- {
- if (!EditorApplication.isPlaying)
- {
- EditorApplication.SaveScene();
- string currentSceneName = EditorApplication.currentScene;
- File.WriteAllText(".lastScene", currentSceneName);
-
- EditorApplication.OpenScene("Assets/Scenes/_Dummy.unity");
- EditorApplication.isPlaying = true;
- }
- else
- {
- string lastScene = File.ReadAllText(".lastScene");
- EditorApplication.isPlaying = false;
- EditorApplication.OpenScene(lastScene);
- }
- }
-
- } // public class RunFromMain : EditorWindow
-
- } // namespace ReaderRabbit
|