Class RemoteConfigService
Use this class to fetch and apply your configuration settings at runtime. RemoteConfigService is wrapper class to mimic the functionality of underlying ConfigManagerImpl class. It uses an instance of ConfigManagerImpl class, making it a primitive class of ConfigManagerImpl.
Namespace: Unity.Services.RemoteConfig
Syntax
public sealed class RemoteConfigService
Properties
appConfig
Retrieves the RuntimeConfig
object for handling Remote Config settings.
Declaration
public RuntimeConfig appConfig { get; set; }
Property Value
Type | Description |
---|---|
RuntimeConfig | A class representing a single runtime settings configuration. |
Remarks
Use this property to access the following RuntimeConfig
methods and classes:
public string assignmentID
is a unique string identifier used for reporting and analytic purposes. The Remote Config service generate this ID upon configuration requests.
public bool GetBool (string key, bool defaultValue)
retrieves the boolean value of a corresponding key from the remote service, if one exists.
public float GetFloat (string key, float defaultValue)
retrieves the float value of a corresponding key from the remote service, if one exists.
public long GetLong (string key, long defaultValue)
retrieves the long value of a corresponding key from the remote service, if one exists.
public int GetInt (string key, int defaultValue)
retrieves the integer value of a corresponding key from the remote service, if one exists.
public string GetString (string key, string defaultValue)
retrieves the string value of a corresponding key from the remote service, if one exists.
public bool HasKey (string key)
checks if a corresponding key exists in your remote settings.
public string[] GetKeys ()
returns all keys in your remote settings, as an array.
public string[] GetJson ()
returns string representation of the JSON value of a corresponding key from the remote service, if one exists.
Instance
Declaration
public static RemoteConfigService Instance { get; }
Property Value
Type | Description |
---|---|
RemoteConfigService |
requestStatus
Returns the status of the current configuration request from the service.
Declaration
public ConfigRequestStatus requestStatus { get; set; }
Property Value
Type | Description |
---|---|
ConfigRequestStatus | An enum representing the status of the current Remote Config request. |
Methods
FetchConfigs<T, T2>(T, T2)
Fetches an app configuration settings from the remote server.
Declaration
public void FetchConfigs<T, T2>(T userAttributes, T2 appAttributes)
where T : struct where T2 : struct
Parameters
Type | Name | Description |
---|---|---|
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
FetchConfigs<T, T2>(String, T, T2)
Fetches an app configuration settings from the remote server passing a configType.
Declaration
public void FetchConfigs<T, T2>(string configType, T userAttributes, T2 appAttributes)
where T : struct where T2 : struct
Parameters
Type | Name | Description |
---|---|---|
String | configType | A string containing configType. If none apply, use null. |
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
FetchConfigs<T, T2, T3>(T, T2, T3)
Fetches an app configuration settings from the remote server passing filterAttributes.
Declaration
public void FetchConfigs<T, T2, T3>(T userAttributes, T2 appAttributes, T3 filterAttributes)
where T : struct where T2 : struct where T3 : struct
Parameters
Type | Name | Description |
---|---|---|
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
T3 | filterAttributes | A struct containing filter attributes. If none apply, use an empty struct. |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
T3 | The type of the |
FetchConfigs<T, T2, T3>(String, T, T2, T3)
Fetches an app configuration settings from the remote server passing a configType and filterAttributes.
Declaration
public void FetchConfigs<T, T2, T3>(string configType, T userAttributes, T2 appAttributes, T3 filterAttributes)
where T : struct where T2 : struct where T3 : struct
Parameters
Type | Name | Description |
---|---|---|
String | configType | A string containing configType. If none apply, use empty string. |
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
T3 | filterAttributes | A struct containing filter attributes. If none apply, use an empty struct. |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
T3 | The type of the |
FetchConfigsAsync<T, T2>(T, T2)
Fetches an app configuration settings from the remote server.
Declaration
public Task<RuntimeConfig> FetchConfigsAsync<T, T2>(T userAttributes, T2 appAttributes)
Parameters
Type | Name | Description |
---|---|---|
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
Returns
Type | Description |
---|---|
Task<RuntimeConfig> |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
FetchConfigsAsync<T, T2>(String, T, T2)
Fetches an app configuration settings from the remote server passing a configType.
Declaration
public Task<RuntimeConfig> FetchConfigsAsync<T, T2>(string configType, T userAttributes, T2 appAttributes)
Parameters
Type | Name | Description |
---|---|---|
String | configType | A string containing configType. If none apply, use null. |
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
Returns
Type | Description |
---|---|
Task<RuntimeConfig> |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
FetchConfigsAsync<T, T2, T3>(T, T2, T3)
Fetches an app configuration settings from the remote server passing filterAttributes.
Declaration
public Task<RuntimeConfig> FetchConfigsAsync<T, T2, T3>(T userAttributes, T2 appAttributes, T3 filterAttributes)
Parameters
Type | Name | Description |
---|---|---|
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
T3 | filterAttributes | A struct containing filter attributes. If none apply, use an empty struct. |
Returns
Type | Description |
---|---|
Task<RuntimeConfig> |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
T3 | The type of the |
FetchConfigsAsync<T, T2, T3>(String, T, T2, T3)
Fetches an app configuration settings from the remote server passing a configType and filterAttributes.
Declaration
public Task<RuntimeConfig> FetchConfigsAsync<T, T2, T3>(string configType, T userAttributes, T2 appAttributes, T3 filterAttributes)
Parameters
Type | Name | Description |
---|---|---|
String | configType | A string containing configType. If none apply, use empty string. |
T | userAttributes | A struct containing custom user attributes. If none apply, use an empty struct. |
T2 | appAttributes | A struct containing custom app attributes. If none apply, use an empty struct. |
T3 | filterAttributes | A struct containing filter attributes. If none apply, use an empty struct. |
Returns
Type | Description |
---|---|
Task<RuntimeConfig> |
Type Parameters
Name | Description |
---|---|
T | The type of the |
T2 | The type of the |
T3 | The type of the |
GetConfig(String)
Retrieves the particular config from multiple config object by passing config type.
Declaration
public RuntimeConfig GetConfig(string configType)
Parameters
Type | Name | Description |
---|---|---|
String | configType | Config type identifier. |
Returns
Type | Description |
---|---|
RuntimeConfig | Corresponding config as a RuntimeConfig. |
SetAnalyticsUserID(String)
Sets analyticsUserId identifier coming from core services.
Declaration
public void SetAnalyticsUserID(string analyticsUserID)
Parameters
Type | Name | Description |
---|---|---|
String | analyticsUserID | analyticsUserId unique identifier. |
SetConfigAssignmentHash(String)
Sets configAssignmentHash identifier coming from core services.
Declaration
public void SetConfigAssignmentHash(string configAssignmentHashID)
Parameters
Type | Name | Description |
---|---|---|
String | configAssignmentHashID | configAssignmentHash unique identifier. |
SetCustomUserID(String)
Sets a custom user identifier for the Remote Config delivery request payload.
Declaration
public void SetCustomUserID(string customUserID)
Parameters
Type | Name | Description |
---|---|---|
String | customUserID | Custom user identifier. |
SetEnvironmentID(String)
Sets an environment identifier in the Remote Config delivery request payload.
Declaration
public void SetEnvironmentID(string environmentID)
Parameters
Type | Name | Description |
---|---|---|
String | environmentID | Environment unique identifier. |
SetPlayerID(String)
Sets playerId identifier coming from auth services.
Declaration
public void SetPlayerID(string playerID)
Parameters
Type | Name | Description |
---|---|---|
String | playerID | Player Id unique identifier. |
SetPlayerIdentityToken(String)
Sets player Identity Token.
Declaration
public void SetPlayerIdentityToken(string playerIdentityToken)
Parameters
Type | Name | Description |
---|---|---|
String | playerIdentityToken | Player Identity identifier. |
SetUserID(String)
Sets userId to InstallationID identifier coming from core services.
Declaration
public void SetUserID(string iid)
Parameters
Type | Name | Description |
---|---|---|
String | iid | Installation unique identifier. |
Events
FetchCompleted
This event fires when the configuration manager successfully fetches settings from the service.
Declaration
public event Action<ConfigResponse> FetchCompleted
Event Type
Type | Description |
---|---|
Action<ConfigResponse> | A struct representing the response of a Remote Config fetch. |