diff --git a/bHapticsManager/TorsoMapperFix.cs b/bHapticsManager/TorsoMapperFix.cs index 8668dd1..e74293b 100644 --- a/bHapticsManager/TorsoMapperFix.cs +++ b/bHapticsManager/TorsoMapperFix.cs @@ -10,8 +10,11 @@ namespace bHapticsManager { public static class TorsoMapperFix { + internal static Harmony? _harmonyInstance = null; + public static void ApplyPatches(Harmony harmony) { try { + _harmonyInstance = harmony; harmony.PatchAll(typeof(TorsoMapperFix)); ResoniteMod.Debug("TorsoMapperFix patches applied successfully"); } @@ -28,9 +31,8 @@ public static class CommonAvatarBuilderPatch { static void Postfix(UserRoot userRoot) { try { - if (!_torsoMapperPatchApplied) { - var harmony = new Harmony("com.nalathethird.bHapticsManager.TorsoMapper"); - ApplyTorsoMapperPatch(harmony); + if (!_torsoMapperPatchApplied && TorsoMapperFix._harmonyInstance != null) { + ApplyTorsoMapperPatch(TorsoMapperFix._harmonyInstance); _torsoMapperPatchApplied = true; } }