FastScriptReload icon indicating copy to clipboard operation
FastScriptReload copied to clipboard

Disable the plugin completely on Silicon

Open acornellier opened this issue 2 years ago • 2 comments

I have FSR installed for use on my Windows PC, but when I use my MacBook, I constantly get an error due it not being compatible with Silicon. I understand nothing can be done to add Silicon compatibility, but it would be nice to disable the plugin completely to avoid the error.

System.TypeInitializationException: The type initializer for 'HarmonyLib.HarmonySharedState' threw an exception. ---> System.Exception: mprotect returned EACCES

acornellier avatar Aug 18 '23 20:08 acornellier

Yeah, would be great to have a global option to turn on/off

brunomikoski avatar Oct 20 '23 10:10 brunomikoski

I'll check it out, it could really be as simple as not running init on mac at all (even without adding user-setting to GUI)

in

        static FastScriptReloadManager()
        {
#if UNITY_EDITOR_OSX
              return; //no silicon support
#endif

            //do not add init code in here as with domain reload turned off it won't be properly set on play-mode enter, use Init method instead
            EditorApplication.update += Instance.Update;
            EditorApplication.playModeStateChanged += Instance.OnEditorApplicationOnplayModeStateChanged;

            ///if <see cref="FastScriptReloadPreference.WatchOnlySpecified"/> is enabled, disable auto reload automatically when launching editor. Will be enabled automatically when adding file watcher manually
            if ((bool)FastScriptReloadPreference.WatchOnlySpecified.GetEditorPersistedValueOrDefault() && SessionState.GetBool("NEED_EDITOR_SESSION_INIT", true))
            {
                SessionState.SetBool("NEED_EDITOR_SESSION_INIT", false);
                ClearFileWatchersEntries();
            }
        }

Also the user-settings are per-machine, if you disable then it won't run on mac image

There's some Harmony patching happening on init, that may need precompiler symbol as well FastScriptReload.Editor.NewFields.NewFieldsRendererDefaultEditorPatch

I don't have immediate access to mac and have to spin it in the cloud - may be easier to quickly check on your end.

handzlikchris avatar Oct 20 '23 10:10 handzlikchris