3. Usage
Updated 10 months agoIn the Awake()
method of your main plugin class, create a new instance of your config class and pass Config
as an argument.
It doesn't have to be stored in any variable. The instance will be handled by CSync.
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//Other Awake code
_ = new ExampleConfig(Config);
}
}
In any class, to access the config values, simply use ExampleConfig.Instance
to access them.
Example: float syncedFloat = ExampleConfig.Instance.syncedVariable
Done!
That's all there is to it. If you have any issues, questions or suggestions, feel free to contact me through Discord @Dreadrith
.