chore: set harmony ID on UnpatchAll call

This commit is contained in:
bd_ 2024-10-01 20:09:47 -07:00
parent 2c9939dea8
commit 4b9d1128c6

View File

@ -11,6 +11,8 @@ namespace nadena.dev.modular_avatar.core.editor.HarmonyPatches
{ {
internal class PatchLoader internal class PatchLoader
{ {
private const string HarmonyId = "nadena.dev.modular_avatar";
private static readonly Action<Harmony>[] patches = new Action<Harmony>[] private static readonly Action<Harmony>[] patches = new Action<Harmony>[]
{ {
//HierarchyViewPatches.Patch, //HierarchyViewPatches.Patch,
@ -19,7 +21,7 @@ namespace nadena.dev.modular_avatar.core.editor.HarmonyPatches
[InitializeOnLoadMethod] [InitializeOnLoadMethod]
static void ApplyPatches() static void ApplyPatches()
{ {
var harmony = new Harmony("nadena.dev.modular_avatar"); var harmony = new Harmony(HarmonyId);
foreach (var patch in patches) foreach (var patch in patches)
{ {
@ -33,7 +35,7 @@ namespace nadena.dev.modular_avatar.core.editor.HarmonyPatches
} }
} }
AssemblyReloadEvents.beforeAssemblyReload += () => { harmony.UnpatchAll(); }; AssemblyReloadEvents.beforeAssemblyReload += () => { harmony.UnpatchAll(HarmonyId); };
} }
} }
} }