Skip to content

Instantly share code, notes, and snippets.

@elringus
Created October 29, 2015 10:34
Show Gist options
  • Save elringus/7a72b24196ccc0bab27c to your computer and use it in GitHub Desktop.
Save elringus/7a72b24196ccc0bab27c to your computer and use it in GitHub Desktop.
using UnityEditor;
[InitializeOnLoad]
public class AutosaveOnRun
{
static AutosaveOnRun()
{
EditorApplication.playmodeStateChanged = () =>
{
if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
{
EditorApplication.SaveScene();
EditorApplication.SaveAssets();
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment