Skip to content

Configurable company for your plugin

You will learn how you can add the API to your project and create simple configurations.

For an in-depth guide on the configurations click one of the following buttons:
Developing pages
Developing categories
Developing configurations
Developing events


To develop with Configurable company, you should have the following mods:

I encourage to use a mod manager to install them and avoid any problems.

Setting up environment


This guide assumes you are using Visual studio as IDE.

Before adding the dependency to your project you should have your base plugin created, if you don't know how see Initial setup and Starting a mod.

You can add the project via NuGet packages or by referencing it manually.

Using NuGet package manager

If you wish to learn how to use NuGet, here is a link to microsoft's guide.

You need to add the package Amrv.ConfigurableCompany. You can add it to your project by using the manage nuget packages option from your project.
Otherwise you can add the reference by manually editing the .csproj file and adding the following tags:

    <PackageReference Include="Amrv.ConfigurableCompany" Version="2.5.0" PrivateAssets="all"/>

Adding dependency manually

First of all you need a copy of the .dll file (wich you can download manually or copy an existing one if you have the mod installed).

Add the Amrv.ConfigurableCompany.dll to the library folder of your project. Make sure you also include it as a reference in the project file project.csproj.


You can reference the full path to the dll that you are using for the game, however I don't recommend using absolute paths.

    <!--You can name the reference however you want as long as unique-->
    <Reference Include="ConfigurableCompany">
        <!--This is an example path, use the one you have with the dll-->

You might as well mark the mod as a hard dependency of your project.


You can get the dependency string and the mod version from the LethalConfiguration class.

[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInDependency(LethalConfiguration.PLUGIN_GUID, BepInDependency.DependencyFlags.HardDependency)] 
    public class YourPlugin : BaseUnityPlugin {
        // The rest of the class goes here ...

How does it work

Configurations and categories need an ID that will identify those configurations even if your plugin is not enabled for the player, also allowing other plugins to interact with your configurations if they need to.

As a convention I recommend that you define your ID's as follows:


ID's must be composed of letters, numbers, underscores or hypens and should be in lowercase. Also they are meant to be unique.

All configurations and categories will be loaded once the player decides to host a game and then the player will be able to modify any configuration to their liking.
Once the player starts the game or saves all the changes will be loaded into their respective configuration. If you want do instantly detect when your configuration has changed you should listen to the corresponding event.

When another player joins, all the configurations will request a synchronization to the client.


Keep in mind configurations depend on the current save file so (for now) until the player selects a file, configurations will hold their default value.

Creating a simple configuration

ConfigurableCompany contains all the resources you need in a class called LethalConfiguration located at the namespace Amrv.ConfigurableCompany. There you can reference and declare everything you might need.

Configurable company uses builder pattern to create pages, categories and configurations, making it very easy to add and update configurations.

Here is an example that adds a ranged float that allows any value from 10 to 100 configuration:

Configuration simpleConfig = LethalConfiguration.CreateConfig("me_my-mod_id")
                                                .SetName("My first configuration")
                                                .SetType(ConfigurationTypes.RangeFloat(10, 100))
                                                .SetTooltip("My cool description")
                                                .Build(); // Note you can omit this Build call if you are assigning the config to a Configuration variable


Note there are more options to build your configurations, a full guide can be found in Developing configs.

Now that you have your simple configuration you might need to get the value. You can get it in multiple ways but the most common ones are:

float value = simpleConfig.Get<float>();
float valueOrDefault = simpleConfig.Get<float>(10f);
int valueCasted = simpleConfig.Get<int>();


You don't know when the user changes the value so as a recomendation you should use the values once the game starts or listen to configuration changes.