Skip to content

Instantly share code, notes, and snippets.

@zapdot
Last active November 3, 2018 11:08
Show Gist options
  • Save zapdot/d0b17579df26cb48ad87 to your computer and use it in GitHub Desktop.
Save zapdot/d0b17579df26cb48ad87 to your computer and use it in GitHub Desktop.
Stop Playing on Recompile
using UnityEditor;
[InitializeOnLoad]
public class StopPlayingOnRecompile
{
static StopPlayingOnRecompile()
{
EditorApplication.update = () =>
{
if (EditorApplication.isCompiling && EditorApplication.isPlaying)
EditorApplication.isPlaying = false;
};
}
}
@zapdot
Copy link
Author

zapdot commented May 23, 2014

Original credit goes to Takuan Daikon (of DFGUI).

@zapdot
Copy link
Author

zapdot commented Oct 13, 2014

Added the EditorApplication.isPlaying check to allow for hitting play soon after to queue a change to playmode as soon as the compiler is finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment