Skip to content

Mod Config

Alchyr edited this page Mar 11, 2026 · 6 revisions

Mods that want customizable config options can register a config with BaseLib.

First, the config options must be defined. Create a class inheriting ModConfig or SimpleModConfig. If using ModConfig you will need to set up the UI for it yourself (explained later).

image

Inside this class, define a public static property for each config value you desire. The value assigned to it will be the default value.

image

Lastly, register the config. This is done in your main mod file's initializer, preferably as soon as possible so that config values will be loaded before the rest of your code runs.

image

These config values are saved locally to %localappdata%/.baselib on Windows. While it is intended to work on other operating systems, this has not yet been tested.

Localization

Add detail - entries in settings_ui.json, key MOD-PROPERTY_NAME.title

Config UI

The config can be found in game Settings -> Mod Settings -> Click a mod -> Gear button on top right. The button will not be visible if a mod does not have a config.

image

If you do not use SimpleModConfig, you will need to override SetupConfigUI. This method receives a Control, and must set up the UI to be displayed by adding it as a child/children of this Control.

SimpleModConfig currently only supports bool and enum values. This should be changed relatively soon.

Clone this wiki locally