It’s not 100% clear in the docs (we’ll be updating it soon to be more clear), but ConfigManager.FetchConfigs needs to be called in order for Remote Config to fetch the config you need. Here’s an example:
public struct UserAttributes {
//any attributes you might want to use for segmentation, empty if nothing
}
public struct AppAttributes {
//any attributes you might want to use for segmentation, empty if nothing
}
public class UseRemoteConfig : MonoBehaviour
{
void Awake()
{
ConfigManager.FetchCompleted += response =>
{
if (response.status == ConfigRequestStatus.Success)
{
Debug.LogFormat("toto: {0}", ConfigManager.appConfig.GetString("toto"));
Debug.LogFormat("titi: {0}", ConfigManager.appConfig.GetInt("titi"));
}
else
Debug.LogError("Remote config : " + response.status);
};
ConfigManager.FetchConfigs<UserAttributes, AppAttributes>(new UserAttributes(), new AppAttributes());
}
}
The *Custom attributes are entirely optional* and // Optionally declare variables for any custom user attributes lines
in the documentation suggest it’s not required to declare userAttributes and appAttributes structs and fetch them.
Perhaps comments placed here would be clearer.
// not here
public struct userAttributes {
// Optionally declare variables for any custom user attributes:
public bool expansionFlag;
}
public struct appAttributes {
// Optionally declare variables for any custom app attributes:
public int level;
public int score;
public string appVersion;
}
It work but push config with editor randomly cause HTTP Bad Request error with really simple rules
like app.level==5 as condition and titi setting set to 5 instead of 2.
push… error
disable titi change in rule, push… it work
re enable titi change, push… it work
change titi = 6 in rule… error