Using Harmony - karlsonmodding/Loadson GitHub Wiki

Generally speaking, simple mods don't need Harmony, that's why it's not included by default in the MDK.
If you want to use Harmony (which is also used by Loadson internally), follow this steps:

  1. Install Lib.Harmony version 2.2.2 via NuGet
  2. Open Project (not Solution) properties, and go to Build Events
  3. In the Post-Build commands insert del 0Harmony* below the other del lines. It should look like:
echo Cleaning bin folder..
del Assembly-CSharp.dll
del LoadsonAPI.*
del Unity*
del 0Harmony*
"$(SolutionDir)ModBuilder.exe"
  1. In your OnEnable() method add the following lines:
HarmonyLib.Harmony harmony = new HarmonyLib.Harmony("<guid>");
harmony.PatchAll();

Where <guid> is your namespace name (aka GUID)

For learning how to use Harmony, this is a great start

⚠️ **GitHub.com Fallback** ⚠️