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

Resolved Fetch a single remote configuration

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

  1. hyunwookimbob

    hyunwookimbob

    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. hyunwookimbob

    hyunwookimbob

    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);
     
    hyunwookimbob likes this.
  5. hyunwookimbob

    hyunwookimbob

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