Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEditor;
- using UnityEditor.SceneManagement;
- using UnityEngine;
- [InitializeOnLoad]
- public class AutosaveUnity {
- static AutosaveUnity() {
- EditorApplication.playmodeStateChanged = () => {
- if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) {
- Debug.Log("Auto-Saving project");
- #if UNITY_5_2 || UNITY_5_1 || UNITY_5_0
- EditorApplication.SaveScene();
- #elif UNITY_5
- EditorSceneManager.SaveOpenScenes();
- #endif
- EditorApplication.SaveAssets();
- }
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement