diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 48d2ffc0..4bdf1629 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -158,7 +158,8 @@ namespace IPA.Loader } } - Task result; + var result = TaskEx.WhenAll(); + if (toDisable.Any()) { // then disable the mods that need to be static DisableExecutor MakeDisableExec(PluginExecutor e) @@ -208,6 +209,7 @@ namespace IPA.Loader var disabled = new Dictionary(); result = TaskEx.WhenAll(disableStructure.Select(d => Disable(d, disabled))); + OnPluginsDisabled?.Invoke(result); } //DisabledConfig.Instance.Changed(); @@ -258,6 +260,14 @@ namespace IPA.Loader /// Called whenever a plugin is disabled. /// public static event PluginDisableDelegate PluginDisabled; + /// + /// Called whenever any plugins are disabled with the representing them being disabled. + /// + /// + /// Note that this is called on the Unity main thread, and cannot therefore block, as the + /// provided represents operations that also run on the Unity main thread. + /// + public static event Action OnPluginsDisabled; /// /// Gets a list of all enabled BSIPA plugins. Use instead of this.