BepInExConfigurationGenerator 0.1.0
dotnet add package BepInExConfigurationGenerator --version 0.1.0
NuGet\Install-Package BepInExConfigurationGenerator -Version 0.1.0
<PackageReference Include="BepInExConfigurationGenerator" Version="0.1.0" />
<PackageVersion Include="BepInExConfigurationGenerator" Version="0.1.0" />
<PackageReference Include="BepInExConfigurationGenerator" />
paket add BepInExConfigurationGenerator --version 0.1.0
#r "nuget: BepInExConfigurationGenerator, 0.1.0"
#:package BepInExConfigurationGenerator@0.1.0
#addin nuget:?package=BepInExConfigurationGenerator&version=0.1.0
#tool nuget:?package=BepInExConfigurationGenerator&version=0.1.0
BepInEx Configuration Generator
This is a configuration generation utility to help you iterate on mods quickly.
Quick Start
Create a class called MyConfig.cs.
To allow the source generator to complete the class,
add the [GenerateConfig] attribute to the class, and mark the class as static partial.
using BepInEx.Configuration.Generators;
[GenerateConfig]
public static partial class MyConfig
{
}
To create a new configuration entry, add a new static readonly field with the [Entry] attribute to the property.
using BepInEx.Configuration.Generators;
[GenerateConfig]
public static partial class MyConfig
{
[Entry("General", "Test", "An integer config")]
private static readonly int Test = 0; // 0 is the default value.
[Entry("General", "Keyboard shortcut", "A keyboard shortcut config (Custom type registered in TomlTypeConverter)")]
private static readonly KeyboardShortcut TestKeyboardShortcut = new(KeyCode.H, KeyCode.LeftControl);
}
Register the configs to your plugin.
// ...
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public sealed class Plugin : BaseUnityPlugin
{
private void Awake()
{
+ MyConfig.Register(Config);
// ...
}
}
You can then read from the entries.
Debug.Log(ConfigTest.TestConfig); // The generated entries append the `Config` suffix.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.