Skip to content

Instantly share code, notes, and snippets.

@decoc
Last active February 11, 2023 08:48
Show Gist options
  • Save decoc/bde047ac7ad8c9bfce7eb408f2712424 to your computer and use it in GitHub Desktop.
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
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