Search Unity

Reading keys from Remote Catalog at runtime

Discussion in 'Addressables' started by KrikeyAdmin, Sep 26, 2019.

  1. KrikeyAdmin

    KrikeyAdmin

    Joined:
    Feb 5, 2018
    Posts:
    29
    Example: I launch a mobile app that is a game that lets the user spawn colored balls. The app is launched only with the colored balls: red, green, blue.

    A week later, we create colored balls: purple, pink, black. We generate the Addressables for them and upload them to our remote server.

    I understand that the whole point of addressables, is that at runtime the launched app could download the newly created 'purple, pink, black' balls using for example: Addressables.LoadAssetAsync("purple");

    But what I can't understand, is HOW the launched app knows that there are now key names / assets of "purple, pink, black" available for use / download?

    I've been searching through the Addressables API and can't seem to find how I can access the available Keys from the remote catalog.... I feel like I'm overlooking something very simple, but am pulling my hair out.

    Thanks
     
  2. KrikeyAdmin

    KrikeyAdmin

    Joined:
    Feb 5, 2018
    Posts:
    29
  3. KrikeyAdmin

    KrikeyAdmin

    Joined:
    Feb 5, 2018
    Posts:
    29
    I finally was able to make some progress. This is not exactly what I was hoping for, but I was able to load the Keys for all the Addressables that belong to a given Label:

    Code (CSharp):
    1. public void Start()
    2. {
    3.     Addressables.LoadResourceLocationsAsync("My_Addressables_Label").Completed += OnLoadAddressableKeys;
    4. }
    5.  
    6. private void OnLoadAddressableKeys(AsyncOperationHandle<IList<IResourceLocation>> obj)
    7. {
    8.     foreach (var k in obj.Result)
    9.     {
    10.         Debug.Log(k.PrimaryKey);
    11.     }
    12. }
    13.