Note
This example is for C# Dotnet Core
To register a dotnet mod using RealLoader, you must attach an attribute to your mod's main class. This class can be named anything. Below is an example of this attribute.
RealLoader/ExampleMod/Sample.cs
Lines 12 to 13 in 6fcb9f5
Tip
Mod compatibility allows you to flag on which environments your mod is meant to run on. Client, Server, Universal.
The parameters for this attribute are
- Your mod's name
- Your contact
- Your alias
- Mod version
- Mod compatibility
A mod may have a parameters-less constructor. We always recommend passing and storing the CancellationToken. You can use this to gracefully shutdown your mod. After cancel has been requested there is a 5 second window to shutdown before a force shutdown occurs.
RealLoader/ExampleMod/Sample.cs
Lines 20 to 24 in 395843c
Tip
Even when an ISbStartup class is not specified, a mod may consume any dependency from the root DI service container via the constructor arguments. In this case, ILogger is satisfied by the DI service.
Loading and unloading are both called as functions a mod must implement.
- Mod load is a mod's main entry point for initial code execution.
- Mod unload has a 5 second window before it will force the shutdown of a mod.