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:
- Install
Lib.Harmony
version 2.2.2 via NuGet - Open Project (not Solution) properties, and go to Build Events
- In the Post-Build commands insert
del 0Harmony*
below the otherdel
lines. It should look like:
echo Cleaning bin folder..
del Assembly-CSharp.dll
del LoadsonAPI.*
del Unity*
del 0Harmony*
"$(SolutionDir)ModBuilder.exe"
- 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