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 Unable to update content post release on iOS and Android devices (1.21.2)

Discussion in 'Addressables' started by Hazardio, Jan 31, 2023.

  1. Hazardio

    Hazardio

    Joined:
    Nov 19, 2018
    Posts:
    25
    Hi everyone! :)

    After many hours of searching a solution, reading documentation and same problem posts, I am actually stuck on my mobile game development : I can't upload new content on devices through addressables.

    In the editor, everything works fine. I also can test my upload via the "Use existing build (iOS / Android)" that detects new uploads and run as expected.

    I am using Addressables 1.21.2, my workflow is the following :
    -Building my app, then collected the bundles generated by this build.
    -Uploading my builds to Unity CCD (buckets are private, I use an access token but nothing wrong about that in the console). I upload ALL the files (bundles, catalog.json, catalog.hash)
    -Testing on the editor, using "Use existing build (iOS / Android)", everything is fine.
    -Testing on my device (the build I made before). Everything is fine.

    Now, I change the color of a material of one of my bundles.

    -In the Addressables Group window, I choose "Update a previous build"
    -I've got a new bundle of the one I've changed.
    -I upload once more EVERYTHING. I now have a modified catalog.json / catalog.hash. I've also got 2 bundles of the edited bundle but with different name)
    -I test on editor with "Use existing build (iOS / Android)", everything is fine.
    -I test on device (no new build so). Update isn't detected...

    My group's parameters (they are all the same):


    My Addressables settings (NB: "Only update catalogs manually" isn't toggled anymore)



    • I have two profiles : one for Android, and one for iOS (I know that I need to builds bundles separatly for both of them). The problem is exactly the same on Android or iOS.
    • In my C# scripts, at the beginning, I call Addressables.InitializeAsync() (not sure if necessary...)
    • I don't select the ".bin" file when I click "Update a previous build" as it is supposed to be automatic in 1.21.2
    • My "Remote.LoadPath" always uses the "latest" badge, no matter the profile

    Can someone help me pls ? :(
     
    Last edited: Jan 31, 2023
  2. Hazardio

    Hazardio

    Joined:
    Nov 19, 2018
    Posts:
    25
    EDIT : I (finally!) fix my issue by updating manually the catalog.
    Letting it updating automatically by the system only work on the editor but not on Android / iOS devices.
    I suppose this is a bug from the addressables.

    Here's my workaround :
    > In the Addressables Assets Settings, check "Only update catalogs manually"
    > When you want to update your catalog, try with the following C# code :
    Code (CSharp):
    1.         //Initialize Addressables
    2.         AsyncOperationHandle initializationOperation = Addressables.InitializeAsync();
    3.         yield return initializationOperation;
    4.         if (initializationOperation.Status == AsyncOperationStatus.Succeeded)
    5.         {
    6.             AsyncOperationHandle checkCatalogOperation = Addressables.CheckForCatalogUpdates(false);
    7.             yield return checkCatalogOperation;
    8.             if (checkCatalogOperation.Status == AsyncOperationStatus.Succeeded)
    9.             {
    10.                 Debug.Log("Addressables : CheckForCatalogOK");
    11.                 var result = checkCatalogOperation.Result as List<string>;
    12.                 if (result != null && result.Any())
    13.                 {
    14.                     AsyncOperationHandle catalogOperation = Addressables.UpdateCatalogs(result, false);
    15.                     yield return catalogOperation;
    16.                     if (catalogOperation.Status == AsyncOperationStatus.Succeeded)
    17.                     {
    18.                         Debug.Log("Addressables : Catalog updated");
    19.                     }
    20.                     else
    21.                     {
    22.                         Debug.Log("Addressables : Failed to update catalog");
    23.                     }
    24.                 }
    25.                 else
    26.                 {
    27.                     Debug.Log("Addressables : No catalog updates");
    28.                 }
    29.             }
    30.             else
    31.             {
    32.                 Debug.Log("Addressables : Failed to check catalogs");
    33.             }
    34.         }
    35.         else
    36.         {
    37.             Debug.Log("Addressables : Failed to Initialize Addressables");
    38.         }
    39.         yield return null;

    Note that you can't call "Addressables.UpdateCatalogs()" without "Addressables.CheckForCatalogUpdates()". Otherwise, it will throw an exception if you haven't content updates.

    Operations aren't released voluntarily.

    I tested the above code, it works for me on the editor, an iOS device and an Android device!
    Maybe I should report a bug for the Unity team ? (I'm using 1.21.2)