Save Scene while on play mode
Unity3D/Extensions / 2014. 1. 12. 00:51
// Simple editor Script that lets you save a scene while in play mode. // WARNING: All Undo posibilities are lost after saving the scene. import UnityEditor; @MenuItem("Example/Save Scene while on play mode") static function EditorPlaying() { if(EditorApplication.isPlaying) { var sceneName : String = EditorApplication.currentScene; var path : String [] = sceneName.Split(char.Parse("/")); path[path.Length -1] = "Temp_" + path[path.Length-1]; var tempScene = String.Join("/",path); EditorApplication.SaveScene(tempScene); EditorApplication.isPaused = false; EditorApplication.isPlaying = false; FileUtil.DeleteFileOrDirectory(EditorApplication.currentScene); FileUtil.MoveFileOrDirectory(tempScene, sceneName); FileUtil.DeleteFileOrDirectory(tempScene); EditorApplication.OpenScene(sceneName); } }
출처 : http://docs.unity3d.com/Documentation/ScriptReference/EditorApplication-isPlaying.html
반응형
'Unity3D > Extensions' 카테고리의 다른 글
ObjectPool (0) | 2014.04.22 |
---|---|
인스펙터 상의 GUI를 비활성화 시키고 싶을 때.. (0) | 2014.04.02 |
Auto-Save Scene on Run (0) | 2014.01.12 |
Combine Children Extented (sources to share) (0) | 2013.01.17 |
SpriteManager (0) | 2012.11.24 |