Last active
June 25, 2020 08:47
-
-
Save jfranmora/971d750658675c0fb9b14a0840a7c3d2 to your computer and use it in GitHub Desktop.
Editor extension, automatically triggers a compilation when entering play mode.
This file contains hidden or 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; | |
namespace JfranMora | |
{ | |
public static class CompileBeforePlay | |
{ | |
[InitializeOnLoadMethod] | |
public static void Initialize() | |
{ | |
if (EditorApplication.isPlaying) return; | |
EditorApplication.update += Update; | |
} | |
private static void Update() | |
{ | |
if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) | |
{ | |
AssetDatabase.Refresh(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment