Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Environment doesn't change

Discussion in 'Unity Remote Config' started by Keraberas, Jun 23, 2021.

  1. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    Hello. Our problem is that when the Remote Config environment changes in any form, the data received from the ConfigManager does not change. We do not forget to save the project at the same time, with the Pull command in the Remote Config window, the correct data really comes. But when the application starts, the ConfigManager still returns the same data from the same environment. We observe the same behavior on the application on Android devices. True, there always comes data from another environment. When we commit to git, we see changes to the entityId parameters in the RemoteConfigDataStoreAsset.asset file. There are no rules in all environments.
     
  2. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    We do not change the environmentID in the code.
    public ConfigHolder(ILocalDataWriter localDataWriter)
    {
    _localDataWriter = localDataWriter;
    UserId = DeviceId.GetId();
    // Set the user’s unique ID:
    ConfigManager.SetCustomUserID(UserId);
    // Add a listener to apply settings when successfully retrieved:
    ConfigManager.FetchCompleted += ApplyRemoteSettings;
    // Fetch configuration setting from the remote service:
    ConfigManager.FetchConfigs(new UserAttributes(), new AppAttributes());
    }

    private void ApplyRemoteSettings(ConfigResponse configResponse)
    {
    if (configResponse.status == ConfigRequestStatus.Success)
    UpdateConfigs();
    else
    Debug.LogWarning("Remote config : " + configResponse.status);
    }

    private void UpdateConfigs()
    {
    var riddleTvSettings = Parse<RiddleTvSettings>(Const.RiddleTvSettings);
    }

    private T Parse<T>(string key)
    {
    var json = ConfigManager.appConfig.GetString(key);
    var result = JsonUtility.FromJson<T>(json);
    return result;
    }
     
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  4. Keraberas

    Keraberas

    Joined:
    Jul 7, 2014
    Posts:
    4
    Thanks for the answer. It turned out that there is a newer version for Remote Config: 2.0.1. We used version 1.0.9 in which there was no SetEnvironmentID method in ConfigManager. Previously, when saving a project, the current environment set in the Remote Config window was changed. Now the behavior of this service has already changed and it always loads the environment data that is installed by default in version 1.0.9. We have updated the project to version 2.0.1 and now we can manually set the EnvironmentID we need.
     
    tagh and JeffDUnity3D like this.