Mod Tutorial
  • 🏠Home
  • 😀Introduction
  • 😇Player Manual
    • 📕Installation
    • 📔How to use it
    • 🐴Attention
  • 😅Make Mod
    • 😅Prepare
    • 😎Create a mod
    • 😘Common Features of NML
    • 🤔Others Common
    • 🥸BepInEx
  • 🤔Basic Concepts
    • 👌Mod Declaration
    • 🎨Mod Interface
    • 🥳Mod Configuration
    • 👍Mod Dependency
    • 🤗Multiligual
  • 😶‍🌫️Resources
    • 😣Overview
    • 😮Resources
    • 😣AssetBundle
  • 😪Other techs
    • 👌Mod Reload
    • 🫥Event Handle
    • 😫Mod Upload
  • 🫨Game Contents
    • 🥳Create Equipment Asset
  • 🤩User Interface
    • 😁Button
    • 😂Tab
    • 😄Prefab
    • 😆Common Window
    • 😋Autolayout Window
  • 😘Packed
    • 😍Basic Mod
  • 🚗NML Development and OpenMods Projects
    • Introduction
    • NML Development
    • NML Documentation
    • Example Mod
    • Unity Development Toolkit
    • Game Documentation
Powered by GitBook
On this page
  • Create from mod template
  • Create from empty folder
  • Create folder
  • Configure IDE
  • Load your mod
  1. Make Mod

Create a mod

PreviousPrepareNextCommon Features of NML

Last updated 1 year ago

There are two options: create from mod template or from empty folder.

Create from mod template

If you know how to use git and have SSH Key configured on Github, just execute the command under GAMEPATH/Mods

git clone git@github.com:WorldBoxOpenMods/ModTemplate.git <ModName>

Otherwise, download , and unzipped it under the folder GAMEPATH/Mods.

Then your folder structure should be like this. Pay attention to directory.

There are several files neccessary to modify

  1. mod.json Modify value of "name" to mod name, "author" to author name. "GUID" to global unique ID of your mod(Determine the ID by yourself to avoid collision with other mods)

  2. ModClass.cs Modify "CHANGEME" to your mod's namespace, and avoid collision with other mods

Then initialize your mod in OnModLoad in file ModClass.cs. BasicMod inherits from MonoBehaviour, you can implement other methods of MonoBehaviour like Update.

Create from empty folder

Create folder

Create a folder under GAMEPATH/Mods, create such two files mod.json and Main.cs like below.

// mod.json
{
    "name": "Change me to Mod name",
    "author": "Change me to Author name",
    "version": "Change me to Mod version",
    "description": "Change me to Mod description",
    "GUID": "Change me to Global Unique ID of your mod"
}
// Main.cs
using UnityEngine;
using NeoModLoader.api;
using NeoModLoader.services;
namespace CHANGEME_TO_YOUR_NAMESPACE;

public class ModClass : MonoBehaviour, IMod
{
    private ModDeclare _declare;
    private GameObject _gameObject;
    
    public ModDeclare GetDeclaration()
    {
        return _declare;
    }
    public GameObject GetGameObject()
    {
        return _gameObject;
    }
    public string GetUrl()
    {
        return "URL of your mod's website or item page on workshop";
    }
    public void OnLoad(ModDeclare pModDecl, GameObject pGameObject)
    {
        _declare = pModDecl;
        _gameObject = pGameObject;
        // Initialize your mod.
        // Methods are called in the order: OnLoad -> Awake -> OnEnable -> Start -> Update
        LogService.LogInfo($"[{pModDecl.Name}]: Hello World!");
    }
}

Configure IDE

Load your mod

You have made a simplest mod now. Launch WorldBox now.

If there are no problems above, you can find this in console:

[NML]: [Mod Name]: Hello World!

And you can also find your mod in "Mods" window provided by NML.

If you use IDE, you should create a .Net Framework4.8 project under GAMEPATH/Mods and then create the two files mod.json and Main.cs below. You can create the project through IDE or write it manually refer to

Add references to your project. Or you can find the .csproj example in (DO NOT COPY ALL DIRECTLY. YOU SHOULD DISTINGUISH WHAT IS USABLE)

😅
😎
ExampleMod.csproj
Configure your IDE manually
ModTemplate
Create from mod template
Create from empty folder
Create folder
Configure IDE
Load your mod
Mod Structure