Configs
This API is used to retrieve configurations from the Gamebeast platform.
For more information about Configurations, visit the Configurations Guide.
var gamebeastConfigs = GamebeastSdk.Configs;Get(configKey)
→ object
This method retrieves a configuration value from Gamebeast.
configKey
string
The key of the configuration to retrieve.
Usage
public class ConfigExample
{
public float myNumber;
}
var configValue = gamebeastConfigs.Get<ConfigExample>("exampleConfigKey");IsReady()
→ bool
This method checks if the configurations have been loaded and are ready to be accessed.
Usage
if (gamebeastConfigs.IsReady())
{
// Configurations are ready to be accessed, do something.
}OnChanged(configName, callback)
→ IDisposable
This event is triggered whenever a specific configuration changes.
configName
string
The name of the configuration to listen for changes.
callback
Action<object>
The callback function to be invoked when the configuration changes. The updated configuration value is passed as a parameter to the callback.
Usage
GamebeastSdk.Configs.OnChanged("MyConfig", () =>
{
var newValue = GamebeastSdk.Configs.Get<string>("MyConfig");
Debug.Log($"Config 'MyConfig' changed! New value: {newValue}");
});OnReady(callback)
→ IDisposable
This callback is triggered when the configurations are fully loaded and ready to be accessed. If the configurations are already loaded, the event will be invoked immediately upon subscription.
callback
Action
The callback function to be invoked when configurations are ready.
Usage
gamebeastConfigs.OnReady(() =>
{
// Configurations are ready to be accessed, do something.
});