Simple & Lightweight solution creating and loading config assets for Unity projects
The package is available on the openupm registry. It's recommended to install it via openupm-cli.
openupm add caneva20.config-assets
Or
Use UpmGitExtension
Or
Find Packages/manifest.json
in your project and edit it to look like this:
{
"dependencies": {
"caneva20.config-assets": "https://github.com/caneva20/ConfigAssets.git#0.2.0-preview.3",
...
},
}
First create a class and extend from Config<T>
public class MyConfig : Config<MyConfig> {}
Then add as many fields as you need, note that it must be Serializable by Unity for it to save
public class MyConfig : Config<MyConfig> {
[SerializeField] private string _myString;
[SerializeField] private bool _myBool = true;
//This also works
public int myInt;
}
And lastly, just call YOUR_CLASS_NAME.Instance.YOUR_FIELD
int valueFromConfig = MyConfig.Instance.myInt;