Class RuntimeConfig
This class represents a single runtime settings configuration. Access its methods and properties via the ConfigManager.appConfig
wrapper.
Inherited Members
Namespace: Unity.Services.RemoteConfig
Assembly: Unity.Services.RemoteConfig.dll
Syntax
public class RuntimeConfig
Fields
configType
The config type for this RuntimeConfig, default is "settings".
Declaration
public string configType
Field Value
Type | Description |
---|---|
string | The configType as a string. |
Properties
assignmentId
The Remote Config service generates this unique ID on configuration requests, for reporting and analytic purposes. Returns null if there is no assignmentId yet.
Declaration
public string assignmentId { get; set; }
Property Value
Type | Description |
---|---|
string | A unique string. |
config
Returns a copy of the entire config as a JObject.
Declaration
public JObject config { get; }
Property Value
Type | Description |
---|---|
JObject |
configAssignmentHash
The Remote Config service generates this unique ID on configuration requests, for reporting and analytic purposes. Returns null if there is no configAssignmentHash yet.
Declaration
public string configAssignmentHash { get; set; }
Property Value
Type | Description |
---|---|
string | A unique string. |
environmentId
The Environment ID that has been returned by the Remote Config Delivery service.
Declaration
public string environmentId { get; set; }
Property Value
Type | Description |
---|---|
string | A string of the environmentID returned. |
origin
Retrieves the origin point from which your configuration settings loaded.
Declaration
public ConfigOrigin origin { get; }
Property Value
Type | Description |
---|---|
Config |
An enum describing the origin point of your most recently loaded configuration settings. |
Methods
GetBool(string, bool)
Retrieves the boolean value of a corresponding key, if one exists.
Declaration
public bool GetBool(string key, bool defaultValue = false)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
bool | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
bool | A bool representation of the key from the remote service, if one exists. If one does not exist, the defaultValue is returned (false if none is supplied.) |
GetFloat(string, float)
Retrieves the float value of a corresponding key from the remote service, if one exists.
Declaration
public float GetFloat(string key, float defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
float | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
float | A float representation of the key from the remote service, if one exists. If one does not exist, the defaultValue is returned (0.0F if none is supplied.) |
GetInt(string, int)
Retrieves the int value of a corresponding key, if one exists.
Declaration
public int GetInt(string key, int defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
int | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
int | An int representation of the key from the remote service, if one exists. If one does not exist, the defaultValue is returned (0 if none is supplied.) |
GetJson(string, string)
Retrieves the string representation of the JSON value of a corresponding key from the remote service, if one exists.
Declaration
public string GetJson(string key, string defaultValue = "{}")
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
string | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
string | A string representation of the JSON value of a corresponding key from the remote service, if one exists. If one does not exist, the defaultValue is returned ("{}" if none is supplied.) |
GetKeys()
Returns all keys in your remote settings, as an array.
Declaration
public string[] GetKeys()
Returns
Type | Description |
---|---|
string[] | An array of properties within config, if one exists. If one does not exist, empty string array is supplied. |
GetLong(string, long)
Retrieves the long value of a corresponding key from the remote service, if one exists.
Declaration
public long GetLong(string key, long defaultValue = 0)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
long | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
long | A long representation of the key from the remote service, if one exists. If one does not exist, the defaultValue is returned (0L if none is supplied.) |
GetString(string, string)
Retrieves the string value of a corresponding key from the remote service, if one exists.
Declaration
public string GetString(string key, string defaultValue = "")
Parameters
Type | Name | Description |
---|---|---|
string | key | The key identifying the corresponding setting. |
string | defaultValue | The default value to use if the specified key cannot be found or is unavailable. |
Returns
Type | Description |
---|---|
string | A string representation of the key from the remote service, if one exists. If one does not exist, the defaultValue is returned ("" if none is supplied.) |
HasKey(string)
Checks if a corresponding key exists in your remote settings.
Declaration
public bool HasKey(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key to search for. |
Returns
Type | Description |
---|---|
bool |
|
Events
FetchCompleted
This event fires when the config is successfully returned from the Remote Config backend.
Declaration
public event Action<ConfigResponse> FetchCompleted
Event Type
Type | Description |
---|---|
Action<Config |
A ConfigResponse struct representing the response. |