Advertisement
Guest User

Unity Autosave on Run

a guest
Oct 27th, 2015
1,999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.41 KB | None | 0 0
  1. using UnityEditor;
  2.  
  3. [InitializeOnLoad]
  4. public class AutosaveOnRun
  5. {
  6.     static AutosaveOnRun()
  7.     {
  8.         EditorApplication.playmodeStateChanged = () =>
  9.         {
  10.             if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
  11.             {
  12.                 EditorApplication.SaveScene();
  13.                 EditorApplication.SaveAssets();
  14.             }
  15.         };
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement