๐ŸŽจMod Interface

Introduction

Mod Main Class Interface

Different with NCMS

NCMS uses ModEntry attribute to locate mod's entry. NML recognizes mod main class by IMod interface.

Same with NCMS

Mod main class needs to be child class of MonoBehaviour.

Mod Function Interface

Except IMod, NML provides IConfigurable(Mod configuration), ILocalizable(Auto multigual), IReloadable(Method hotfix) and so on(more interfaces will be added in the future).

Interface Packed

It is hard to implement too many interfaces. So there is BasicMod which implements IMod, IConfigurable, ILocalizable already and provides some useful functions.

Related Example

IMod

It is always used for mod main class. If you implements it manually, the class should also inherit from MonoBehaviour.

IMod requires to implement the following four methods

IConfigurable

If a mod's main class implements IConfigurable, you can see an entry button of configuration window for the mod.

IConfigurable requires to implement the following method

See more about ModConfig in Mod Configuration

ILocalizable

If a mod's main class implements ILocalizable, NML will load its locales text before OnLoad

ILocalizable requires to implement the following method

IReloadable

If a mod's main class implements IReloadable and set Config.isEditor=true, you can see a reload button for your mod.

Limit Config.isEditor=true is to avoid users to click reload button carelessly.

IReloadable requires to implement the following method

Except IReloadable, NML also provides Hotfixable attribute for method. It marks what method to be hotfixed. See more in Mod Reload

Last updated