-
Notifications
You must be signed in to change notification settings - Fork 26
Mod Config
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).
Inside this class, define a public static property for each config value you desire. The value assigned to it will be the default value.
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.
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.
Add detail - entries in settings_ui.json, key MOD-PROPERTY_NAME.title
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.
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.