Skip to content

Instantly share code, notes, and snippets.

@Monsoonexe
Last active October 18, 2023 23:21
Show Gist options
  • Save Monsoonexe/9688ea3cf8a0cdac0af9993d5d238ded to your computer and use it in GitHub Desktop.
Save Monsoonexe/9688ea3cf8a0cdac0af9993d5d238ded to your computer and use it in GitHub Desktop.
Tool for Unity Editor to un/lock unity's compiler, preventing it from compiling when it is inconvenient
private const string CompilerLockMenu = "Tools/Lock Compiler";
[MenuItem(CompilerLockMenu)]
public static void ToggleCompilerLock()
{
// get current state
bool locked = Menu.GetChecked(CompilerLockMenu);
// flip
Menu.SetChecked(CompilerLockMenu, !locked);
if (locked)
{
EditorApplication.UnlockReloadAssemblies();
}
else
{
EditorApplication.LockReloadAssemblies();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment