Modding:Monkey patching: Difference between revisions

From Vintage Story Wiki
→‎Cleaning Up: handle harmony possibly being null in single player
(→‎Basic Patching: prevent the patches from getting double applied)
(→‎Cleaning Up: handle harmony possibly being null in single player)
Line 98: Line 98:
<syntaxhighlight lang="c#">
<syntaxhighlight lang="c#">
     public void Dispose() {
     public void Dispose() {
         harmony.UnpatchAll("MyModId");
         harmony?.UnpatchAll(Mod.Info.ModID);
     }
     }
}
}
Confirmedusers
510

edits