-
Notifications
You must be signed in to change notification settings - Fork 38
Mod Configuration
cheese3660 edited this page Feb 26, 2023
·
3 revisions
using SpaceWarp.API.Configuration;
using Newtonsoft.Json;
namespace Namespace;
[JsonObject(MemberSerialization.OptOut)]
[ModConfig]
public class Config {
...
}
To create a new field do the following (this creates an input/toggle field in the config editor in Space Warp)
[ConfigField("name")]
[ConfigDefaultValue(3)] // Optional
public int name;
[ConfigSection("folder/in/menu")]
[ConfigField("name")]
...
using SpaceWarp.API.Configuration;
.
.
.
ManagerLocator.TryGet(out ConfigurationManager configManager);
Config conf = null; //Config is the name of your configuration class
if (configManager.TryGet("mod_id",out var config)) conf = (Config)conf.configObject;