Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Fetch a single remote configuration

Discussion in 'Unity Remote Config' started by davidkimighty, Apr 4, 2023.

  1. davidkimighty

    davidkimighty

    Joined:
    Mar 10, 2023
    Posts:
    8
    Is there a way to fetch a single remote config instead of fetching the whole thing?
     
  2. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    Whats your use case? As there might be a better way to do it.
     
  3. davidkimighty

    davidkimighty

    Joined:
    Mar 10, 2023
    Posts:
    8
    I'm currently using
    FetchConfigsAsync
    this function to fetch all my configs, but I was wondering if there was a way to fetch a single config using a key and not update every other configs.

    There's a situation where I just need to check if one config value is updated, and I don't want to fetch everything else just because of that one config. I am assuming this could be a problem? when I have many other configs with long values.
     
    Julian-Unity3D likes this.
  4. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    You can:
    • Use the filterAttributes structure to provide custom filter-category attributes in order to reduce the payload.
    • Use Rest API and filter a key.
    c# solutuion:
    Code (CSharp):
    1. public struct filterAttributes {
    2.       // Optionally declare variables for attributes to filter on any of following parameters:
    3.         public string[] key;
    4.         public string[] type;
    5.         public string[] schemaId;
    6.     }
    7.  
    8. // Example on how to fetch configuration settings using filter attributes:
    9.         var fAttributes = new filterAttributes();
    10.         fAttributes.key = new string[] { "sword","cannon" };
    11.         RemoteConfigService.Instance.FetchConfigs(new userAttributes(), new appAttributes(), fAttributes);
     
    davidkimighty likes this.
  5. davidkimighty

    davidkimighty

    Joined:
    Mar 10, 2023
    Posts:
    8
    ohh that is how you use it. thank you!
     
    Julian-Unity3D likes this.