Search Unity

How can I get the type of the Keys (

Discussion in 'Unity Remote Config' started by VrGamesDev, May 10, 2021.

  1. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    Hello,

    I can't find a way to get the proper type of my remote config server data.

    Lets assume I have an INT, that is named "myInt" and has a value of "10"

    If I query the ConfigManager if the key exists, it replay "true", because it does.

    - ConfigManager.appConfig.HasKey("myInt"))

    If I don't know what kind of Type (Bool, Int, Float, String, Long). I don't know what kind of type to query from.

    I can query all the types, and all the types return me a "10" value:

    print("GetBool(myInt) = " + ConfigManager.appConfig.GetBool("myInt"));
    print("GetInt(myInt) = " + ConfigManager.appConfig.GetInt("myInt"));
    print("GetFloat(myInt) = " + ConfigManager.appConfig.GetFloat("myInt"));
    print("GetString(myInt) = " + ConfigManager.appConfig.GetString("myInt"));



    How can I get the types of my Keys?

    P.S: I can get all the keys with:

    string[] aAllMyKeys = ConfigManager.appConfig.GetKeys();


    But I don't know its type, help please
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You as the developer already know the type that you created. Can you describe your use case?
     
  3. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    Sure, I am creating an Asset for the asset store, so I don't know what my customers will create, I am trying to download and have all the keys, in the first load, to present the server data to the user in an object in the inspector.

    That way you can have in the game all the options (a pretty UI) and in the inspector, so I can use local data or remote data within a simple interphase.

    But I don't know what kind of info is in the catalogue, I just know the keys, and all the GetDataType returns the same data.

    Was I clear?
     
    Last edited: May 10, 2021
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, makes perfect sense, thanks. You might be able to use the REST API to get that info https://remote-config-api-docs.uca.cloud.unity3d.com/
     
  5. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    For example, I report what is available and the value in a report in html, but I need to know the data type
     

    Attached Files:

  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It looks like the Config API returns the datatype, I haven't tested.
     
  7. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    I already read all the REST API.

    And I can't find any method or way to get the keys... May I ask for a more detailed URL where to find it?
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You may be right, if you've already looked at the Config api section. I'll ask the team too.
     
  9. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    Thanks a lot, I appreciate your quick responses
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    "The Remote Config web APIs require authentication via Unity's APIs. To authenticate with Unity, use a Unity account with permission to access the appropriate Organization and Project (manage accounts and roles in the developer dashboard). In the POST payload below, replace [username] and [password] with your Unity account login information."

    I already checked, and I don't want to ask my users to provide its unity login / pass to my asset so it can get the type data.

    Is there another way to get the type of the remote config Keys?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not at this time, I have mentioned this feature request to engineering.
     
  13. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    Thanks a lot, it is easy for my own environment and games (like you said, I already know what type is, I created it), not that comfortable to ask for a user
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    But it's a one time configuration, and it's in the developer's Editor and on their system with their username and password, correct? How are you allowing them to set their keys and values?
     
  15. VrGamesDev

    VrGamesDev

    Joined:
    May 7, 2018
    Posts:
    65
    I mean when you build the client
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, I understand that. But if they are retrieving value datatypes, how did their data get there?