Modder Documentation

Skills you'll need: Basic-Intermediate C#, an understanding of Unity concepts (from a programmer's perspective) such as the scene graph, ECS, and YAML deserialization.

Get your hands on a C# IDE, like Visual Studio. I'm not going to tell you how to set that up here, figure it out yourself!!

In VS, make a new class library project, that depends on .NET 3.5. This is the maximum version supported by this version of Unity.

When GKML is installed, a DLL is copied to the Managed folder called GarfieldKartModLoaderLib.dll. This is the modloader library, you will need to depend on it for your mod.

Your mod's entry point class must extend the GKML.Mod class.

The primary mechanism for code patching is the Harmony library. Read up on their documentation. A HarmonyInstance is automatically provided for you in the variable patcher.

You are not required to register any patches, they will be automatically added if they are included in your mod dll.

Speaking of mod dll, the mod file format is as follows: TestMod.gkmod (a zip file) contains a TestMod.modinfo (JSON), a TestMod.dll, and an optional asset bundle TestMod.unity3d. All the files must have the same name as the mod

The .modinfo file has the following JSON fields: string Name (required), string Namespace (required), string[] Authors, string Version, string GKMLVersion (required), string Description

Currently, only the required fields are used. The current version of GKML at the time of writing is 0.1.1

You may also find it useful for your mod to depend on Assembly-CSharp, the game code. DO NOT MODIFY THIS DLL, MAKE HARMONY PATCHES INSTEAD.

With that out of the way, you may find an example useful. The test mod project is downloadable here.

Any questions can be directed to me in the #mod-general channel of my discord. I'll be updating this documentation often with tips, tutorials, etc., so check back often!