The Long Dark Modding Wiki

Harmony is used to introduce new code into the game.


HarmonyX Documentation[]

HarmonyX is a fork of Harmony 2. It is the version included with MelonLoader 4.

Harmony 2.0 Documentation[]

Since HarmonyX is based on Harmony 2, most of the documentation for Harmony 2 is valid for HarmonyX.

Harmony 1.2 Documentation[]

MelonLoader 2.7 (an older version) makes Harmony 1.2 available for mod users. This is the official documentation for that version of Harmony.


Many methods get inlined during the game's compilation. This means that the compiler inserted their code into all the places that call that method in order to optimize game performance. Patching inlined methods will not affect the game, other than changing how other mods use that method.

Identifying inlined methods[]

dnSpy is a great tool for analyzing the game. If you have a v1.56 "Assembly-CSharp.dll", it can be opened to view old source code. The current decompiled one can be found in "\TheLongDark\MelonLoader\Managed". It cannot be used to view source code, but it does include caller counts. Methods with a positive caller count have not been inlined. Methods with a zero caller count have probably been inlined (the only way to know for sure is to patch them with a postfix containing a log statement).

Method calls that never get inlined[]

  • "Awake"
  • "Start"
  • "Update"
  • Delegates. Their names normally start with "On" such as "OnEat", "OnDeath", or "OnEnter"
  • Any other methods called by reflection
  • Virtual method overrides

These methods are not inlined even though they show a zero caller count in dnSpy. This is because only direct calls are visible to the cross referencing algorithm used to create the caller counts.

Note: it is possible, albeit rare, for a method to have both direct calls and reflection calls. In this situation, the direct calls might get inlined whilst the reflection calls remain patchable. This would result in the patch only applying to the reflection calls.


Transpilers do not work with Il2Cpp because the game is machine code not IL code.