*
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[InitializeOnLoad]
|
||||
public class AutosaveOnRun
|
||||
{
|
||||
static AutosaveOnRun()
|
||||
{
|
||||
EditorApplication.playmodeStateChanged = () =>
|
||||
{
|
||||
if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
|
||||
{
|
||||
Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
|
||||
|
||||
EditorApplication.SaveScene();
|
||||
EditorApplication.SaveAssets();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user