Last active
February 11, 2023 08:48
-
-
Save decoc/bde047ac7ad8c9bfce7eb408f2712424 to your computer and use it in GitHub Desktop.
This editor utility can lock/unlock unity script compile from menu item. See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile
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 UnityEngine; | |
using UnityEditor; | |
/// <summary> | |
/// This editor utility can lock/unlock unity script compile from menu item. | |
/// See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile | |
/// </summary> | |
public static class CompileLocker | |
{ | |
[MenuItem("Compile/Lock", false, 1)] | |
static void Lock () | |
{ | |
var menuPath = "Compile/Lock"; | |
var isLocked = Menu.GetChecked(menuPath); | |
if (isLocked) | |
{ | |
Debug.Log("Compile Unlocked"); | |
EditorApplication.UnlockReloadAssemblies(); | |
Menu.SetChecked(menuPath, false); | |
} | |
else | |
{ | |
Debug.Log("Compile Locked"); | |
EditorApplication.LockReloadAssemblies(); | |
Menu.SetChecked(menuPath, true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment