

A library mod that lets other mods add properties and methods to existing base-game classes at runtime, without modifying game files.
This mod does nothing on its own – it exists to support other mods.
This library provides an interface-based monkey-patching system for Unity games.
Instead of creating your own preloader, mod authors define interfaces that describe the methods/properties they want to add. At runtime, the library injects those interfaces into the target classes using metadata provided by custom attributes.
This approach keeps patches:
RequiresInjectionsMarks an assembly as containing injectable interfaces.
This attribute is required for the library to detect your mod.
Usage
Without this attribute, your mod will be ignored entirely.
InjectInterfaceSpecifies the base-game class that an interface should be injected into.
Usage
Type reference or class name of a base-game classAn interface may target multiple classes by applying multiple InjectInterface attributes.
Injection errors can be handled using the HandleErrors attribute.
If no attribute is specified, the default behavior is Terminate.
HandleErrorsDefines how the library reacts when an error occurs during injection.
Usage locations
More specific scopes override more general ones.
ErrorHandlingStrategyAvailable error handling strategies:
Terminate (Default)
Immediately stops the injection process when an error occurs.
Ignore
Silently ignores errors and continues execution.
LogWarning
Logs the error as a warning and continues execution.
LogError
Logs the error as an error and continues execution.
When multiple HandleErrors attributes are present, the following order applies (highest priority last):
The most specific setting always wins.
This library is intended for:
It is not intended for direct use by end users.
using InjectionLibrary;
using InjectionLibrary.Attributes;
[assembly: RequiresInjections]
[assembly: HandleErrors(ErrorHandlingStrategy.Terminate)]
namespace ExampleMod.Interfaces;
[HandleErrors(ErrorHandlingStrategy.LogError)]
[InjectInterface(nameof(StartOfRound))]
public interface ICrashingInterface
{
void Awake();
[HandleErrors(ErrorHandlingStrategy.LogWarning)]
void Start();
[HandleErrors(ErrorHandlingStrategy.Ignore)]
void Update();
}