This editor utility can lock/unlock unity script compile from menu item. See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile

August 6, 2020 ยท View on GitHub

using UnityEngine; using UnityEditor;

///

/// This editor utility can lock/unlock unity script compile from menu item. /// See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile /// 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);
    }
}

}