Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

ConfigManager.SetEnvironmentName ?

Discussion in 'Unity Remote Config' started by Fangh, Aug 27, 2020.

  1. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    217
    Hello.
    On Unity Side, how can you set the environment by name before fetching the configuration ?
    Because on client side, you don't know the environment ID.

    This is my use case :
    - The client need to get all the keys in the environment "deviceUniqueID". So this is what I would like to do :

    Code (CSharp):
    1. ConfigManager.SetEnvironmentName(SystemInfo.deviceUniqueIdentifier);
    2. ConfigManager.FetchConfigs()
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Wouldn't that environmentID be unique to each device? Thousands of users = thousands of environments?
     
  3. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    217
    Yes. I Do that because I don't want the user to download ALL the config. Because I want to put some config foreach of my customers.
    I want my customers to download only their config, not the config of all customers.

    (I won't have thousands of customers. Maybe 100 max)
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it! Interesting use case. As long as the users have only one device and you disclose the data collection, that approach might work. Then a process would need to keep all the environments in sync, in case you needed to add new values during an app update.
     
  5. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    217
    What do you mean by "disclose the data collection"

    What I have done :
    The Default env have a table like this :
    [deviceUniqueID, env-id]

    So I downlaod this table of all env-id, then I search for my own deviceUniqueId in this table to find the right env-id then I redownload the Config by setting the env-id and I have the data I need.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You are sending and storing the users deviceID. And I have 2 Android devices for example, this wouldn't work for users with multiple deviceIDs. Unless you're ok with the experience being different on each device. Your original code used the deviceID for the envID, I didn't see the lookup

    ConfigManager.SetEnvironmentName(SystemInfo.deviceUniqueIdentifier);
     
  7. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    217
    Yes it wouldn't work for the same user with differents deviceId, you are right. But I want a different experience for different devices. (actually I use RemoteConfig for Licensing my business VR app. So one headset = one license).

    this is what I wanted to do, first :

    1. I sell a license (ie: 3 month) for a headset A to a customer X
    2. I go inside headset A, get its deviceID (ie: 123456)
    3. I go on my dashboard, create a new environment named 123456
    4. In the code of my headset here is the code :
    Code (CSharp):
    1. ConfigManager.SetEnvironmentName(SystemInfo.deviceUniqueIdentifier);
    2. ConfigManager.FetchConfigs()
    But I can't do that because ConfigManager.SetEnvironmentName() does not exist.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please contact me directly, our Product Manager would be interested in discussing your use case.