Advertisement
ihatetn931

ConfigurationManager Stationeers

Aug 3rd, 2023
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | Gaming | 0 0
  1. using BepInEx;
  2. using BepInEx.Configuration;
  3. using HarmonyLib;
  4. using UnityEngine;
  5.  
  6. namespace ConfigExample
  7. {
  8.     [BepInPlugin(PLUGIN_GUID, PLUGIN_NAME, PLUGIN_VERSION)]
  9.     public class PluginName : BaseUnityPlugin
  10.     {
  11.         public const string PLUGIN_GUID = "your.mod.gui";
  12.         public const string PLUGIN_NAME = "your.mod.name";
  13.         public const string PLUGIN_VERSION = "1.0.0";
  14.  
  15.         internal static ConfigEntry<bool> Toggle;//true or false
  16.         internal static ConfigEntry<int> Intvalue; //uses int values
  17.         internal static ConfigEntry<KeyboardShortcut> KeyBind;//hot keys
  18.  
  19.         void Awake()
  20.         {
  21.             Harmony harmony = new Harmony(PLUGIN_GUID);
  22.             harmony.PatchAll();
  23.             Toggle = Config.Bind("Category Name", "Enable", true, new ConfigDescription("", null, null));//this is a bool value
  24.             Intvalue = Config.Bind("Category Name", "Value Name", 128, new ConfigDescription("", new AcceptableValueRange<int>(0, 255), null)); //this is a slider
  25.             KeyBind = Config.Bind("Category Name", "HotKey Name", new KeyboardShortcut(KeyCode.F6), new ConfigDescription("", null, null));//this is a keybind
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement