Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- [InitializeOnLoad]
- public class AutoSave: MonoBehaviour {
- static AutoSave() {
- EditorApplication.playmodeStateChanged = () =>
- {
- if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) {
- Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
- EditorApplication.SaveScene();
- EditorApplication.SaveAssets();
- }
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment