Last active
June 12, 2018 15:42
-
-
Save ryosebach/dfb8552697e8b1c58aebd6766f9bfe86 to your computer and use it in GitHub Desktop.
再生時にシーンをセーブする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Copyright (c) 2018 ryosei ogawa | |
| This software is released under the MIT License. | |
| http://opensource.org/licenses/mit-license.php | |
| */ | |
| using UnityEngine; | |
| using UnityEditor; | |
| using UnityEditor.SceneManagement; | |
| using UnityEngine.SceneManagement; | |
| [InitializeOnLoad] | |
| public class AutosaveOnRunning : ScriptableObject | |
| { | |
| static AutosaveOnRunning() | |
| { | |
| EditorApplication.playModeStateChanged += (_) => { | |
| if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) | |
| { | |
| EditorSceneManager.SaveScene(SceneManager.GetActiveScene()); | |
| AssetDatabase.SaveAssets(); | |
| } | |
| }; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment