Creating a mod
This guide will teach you the first step in creating a mod.
1. The mod folder
You first need to create a new folder inside the game's "Mods" folder. This folder is ideally named after your mod and is otherwise empty.
Inside your newly created folder, you need to create a mod.json
file in order for the game to detect it. You can create one manually by looking at the metadata article, or you can generate one using the online generator.
An important detail here is that your author name and mod name should form a globally unique combination. Leave the scripts
value as just script.cs
for now, and leave the EntryPoint
as Mod.Mod
.
2. Script files
Create a script.cs
file in the mod folder, as specified in the mod.json
file.
Your mod folder should now contain two files: the mod.json
file and a script.cs
file.
A .cs
file is a C# file. C# is the programming language People Playground and all its mods use. This is where you'll write all your code as well.
Because this is your only script file, it will contain the entry point. This is where the code lives that is first executed by the game. The entry point path is specified in the mod.json
file, and should be Mod.Mod
in your case.
Mod.Mod
means "the Mod
class , in the Mod
namespace. This means your C# file should look like this:
using UnityEngine; //You'll probably need this...
namespace Mod
{
public class Mod
{
public static void Main()
{
//This method is the entry point.
}
}
}
That's it. This mod will show up in the mod list, but it doesn't do anything yet. If you know C#, read the API documentation.