


LethalConfig is an in-game mod configuration menu that can be used by any mod developer to let players change their BepInEx's ConfigEntry's within the game through a variety of UI controls.
Inspired by Rune580's RiskOfOptions
Currently, LethalConfig allows developers to add the following types of interfaces for ConfigEntry's:
| Component | Value Type | ConfigItem Type |
|---|---|---|
| Integer Slider | int |
IntSliderConfigItem |
| Integer Input Field | int |
IntInputFieldConfigItem |
| Float Slider | float |
FloatSliderConfigItem |
| Float Step Slider | float |
FloatStepSliderConfigItem |
| Float Input Field | float |
FloatInputFieldConfigItem |
| Text Input Field | string |
TextInputFieldConfigItem |
| Enum Dropdown | Enum |
EnumDropDownConfigItem<> |
| Boolean Checkbox | Enum |
BoolCheckBoxConfigItem |
An example of the LethalConfig menu and its element types
To start using LethalConfig on your mod, add a reference on your project to the LethalConfig's dll file. You can get the dll by downloading the LethalConfig mod on Thunderstore.
To access the API, simply use the LethalConfig namespace or import it on your source file:
using LethalConfig;
It is also recommended to add a BepInDependency attribute to your plugin to hint BepInEx that your mod has a dependency to it:
[BepInPlugin(PluginInfo.Guid, PluginInfo.Name, PluginInfo.Version)]
[BepInDependency("ainavt.lc.lethalconfig")]
public class MyVeryCoolPlugin: BaseUnityPlugin {
...
}
With everything setup, you should now have access to the main LethalConfigManager and are able to add any of the available components you want.
First, you create your ConfigEntry from BepInEx like you would normally:
var configEntry = Config.Bind("General", "Example", 0, "This is an example component!");
With your ConfigEntry in hand, you can now create and register a new item to the menu by using the following method:
var exampleSlider = new IntSliderConfigItem(configEntry, new IntSliderOptions
{
Min = 0,
Max = 100
});
LethalConfigManager.AddConfigItem(exampleSlider);
And that's it, you now have created your first component!

LethalConfig automatically picks up some of your mod info, and it automatically creates sections based on the section of the provided ConfigEntry, so you do not have to worry about any extra setup in terms of layout.
By default, all items will be set to require a restart if changed. This will give a warning to the player once they apply the settings.
If you want your items to not be flagged as restart required, simply flag the constructor of the config items, either through the bool constructor overload or passing it inside the item's specific options:
// Using the slider options object
var exampleSlider = new IntSliderConfigItem(configEntry, new IntSliderOptions
{
RequiresRestart = false,
Min = 0,
Max = 100
});
// Using the bool constructor overload
var exampleSlider = new IntSliderConfigItem(configEntry, requiresRestart: false);
Note that players will most likely expect settings to take effect immediately if not prompted to restart. If you need to listen to changes to values of your configuration, ConfigEntry provides a mechanism for that:
configEntry.SettingChanged += (obj, args) =>
{
logSource.LogInfo($"Slider value changed to {configEntry.Value}");
};
If you have an issue with LethalConfig, or want to suggest a feature, feel free to open an issue at the GitHub repository.
Alternatively, you can also leave your suggestions and issues on the LethalConfig post under the Mod Releases forum in the Unofficial Lethal Company Discord Server.
- Added two new config types:
- IntInputConfigItem (an integer text field)
- FloatInputConfigItem (a float text field)
- Fixed missing default value in the enum dropdown's description.
Initial release, which includes the following types:
- IntSliderConfigItem
- FloatSliderConfigItem
- FloatStepSliderConfigItem
- EnumDropDownConfigItem
- BoolCheckBoxConfigItem
- TextInputFieldConfigItem