Skip to content
Zetrith edited this page Jul 28, 2021 · 8 revisions

The mod adds a Hot Swap button to the ingame dev mode. After clicking it, all mod assemblies are searched for types with an attribute [HotSwappable]. The code of the methods within these types is then replaced with the one found in the assembly files on disk.
The attribute is searched by name, so you can just create your own one and not have to add any dependencies. It can be added during runtime.

Here's the code for the attribute:

[AttributeUsage(AttributeTargets.Class)]
public class HotSwappableAttribute : Attribute
{
}

Note that hotswapping generic methods and methods in generic types is not supported for now as the Harmony library used for code generation currently doesn't fully support generics either. Also, adding new methods/types is currently not supported though that might change in the future.

Clone this wiki locally