-
-
Save jbubriski/d101a96ecf69fbd9e72af0de902722fe to your computer and use it in GitHub Desktop.
Force Unity to stop playing if you have edited a source file. Helps avoid some editor crashes and false positives / error spam. To use, drop this script in an "Editor" folder in your project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
[InitializeOnLoad] | |
public class StopPlayingOnRecompile | |
{ | |
static StopPlayingOnRecompile() | |
{ | |
EditorApplication.update += () => | |
{ | |
if (EditorApplication.isCompiling && EditorApplication.isPlaying) | |
EditorApplication.isPlaying = false; | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment