Modding:Harmony: Difference between revisions

866 bytes added ,  06:51, 25 March 2021
Added details on when to avoid Harmony Patches
No edit summary
(Added details on when to avoid Harmony Patches)
Line 5: Line 5:


For a primer on using Harmony to patch game methods, see [https://harmony.pardeike.net/articles/patching.html this article].
For a primer on using Harmony to patch game methods, see [https://harmony.pardeike.net/articles/patching.html this article].
While Harmony Patches are powerful and are often the easiest and most obvious way to modify behaviour, they are very prone to buggy behaviour and incompatibility with other mods and future updates. Many things that seem like they can be done with a Harmony Patch at first glance would actually be better achieved by creating a new Part with the desired behaviour and adding it to the required objects - or a similar solution.
That said, there do remain some situations in which harmony patches are required in order to affect certain functionality. In these cases, Postfix Patches tend to be the most compatibility friendly, followed by non-blocking Prefix Patches. Prefix Patches that prevent the main function from running or Transpiler Patches that modify the IL Code of a function are often problematic and should be avoided unless they are the only option.


== Example: Chaotic-Colored Message Text ==
== Example: Chaotic-Colored Message Text ==
Anonymous user