Creating Mods
This article will cover how to setup a mod project using the RedManager as it's the easiest way. If you want to use the template directory you can see it here.
Creating the project (RedManager)
- Start up the RedManager
- If you path isn't correctly set, adjust it
- Head over to the
Modders
tab - Click on
Install template
if you haven't installed the template yet - Put in your mod name and click
Create Project
- Select the target folder for your mod (a subfolder with your mod name will be created in the target folder)
Creating the project (CLI)
If you want to use the command line to create your project look at the readme here.
IMPORTANT
The RedManager can't update the template once a new one comes out. If you want to update the template open up the console and execute dotnet new install RedLoader.Templates
.
Project description
The project includes several features out of the box:
- The mod will automatically be copied to the game on build
- If you use Rider you can press
Ctrl+F5
to automatically copy the mod and run the game
If you set the mode to release it will:
- Automatically create a folder with the correct mod structure
- Automatically create a zip with the created folder
The template also sets up a basic mod for you. You should be able to just build the mod and see the mod being loaded.
Adjusting the mod info
The first thing you should do is adjust your mod info (like author, mod name etc.) in the manifest.json
file. The file is linked to a valid json schema, so if you are ever unsure what you can write in there just press Ctrl+Space
to open autocomplete.
Tips
If you want to automatically apply harmony patches for your assembly add HarmonyPatchAll = true;
to your constructor (or uncomment it).
If you want to subscribe to unity's OnUpdate
, OnFixedUpdate
, OnGUI
and OnLateUpdate
message queue you can register it in the constructor by for example using OnUpdateCallback = MyMethod
.
To reference additional assemblies, add them from the _RedLoader/Game
folder. Non game assemblies like harmony can be referenced from the _RedLoader/net6
folder.