Created
November 24, 2021 16:21
-
-
Save instance-id/a23b3d7b6674588df7ff17eeb7844bfb to your computer and use it in GitHub Desktop.
Lock compilation so you can move folders and items without compiling on each one
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 UnityEngine; | |
using UnityEditor; | |
// -- Place in Editor Folder ------------ | |
namespace instance.id.Extensions.Editors | |
{ | |
/// <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("Tools/instance.id/Compile/Lock", false, 1)] | |
static void Lock() | |
{ | |
var menuPath = "Tools/instance.id/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