Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to get download size of content update without updating the catalog first?

Discussion in 'Addressables' started by Peter77, Jul 31, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    Unity 2019.4.20f1, Addressables 1.18.13

    How can I get the download size of a content update without having to update the catalog first?

    It seems I have to call
    Addressables.UpdateCatalogs
    in order to get the download size with
    Addressables.GetDownloadSizeAsync
    of any content that hasn't been downloaded yet.

    However, calling
    Addressables.UpdateCatalogs
    causes that any
    Addressables.Load
    call from then on will load the updated bundles from the server under the hood automagically. This isn't the desired behavior I'm after.

    I want to get the download size of a content update and ask the user "Do you want to download the latest content? Download size: 123 MB".
    1. If the users chooses "no", I want to keep using the existing, already downloaded, bundles and catalog instead. No new bundle should be downloaded at any point. But due to the earlier UpdateCatalogs call, even when the user declined the update, Addressables downloads files when game code loads content with Addressables.LoadSceneAsync for example, where an update is available on the server.
    2. If the user chooses "yes", I would call
      Addressables.UpdateCatalog
      and
      Addressables.DownloadDependenciesAsync
      to download the content update.

    I didn't find out how to get the download size of a content update without modifying the local catalog.
     
    Jonas-Neuston likes this.
  2. Jonas-Neuston

    Jonas-Neuston

    Joined:
    Jun 10, 2017
    Posts:
    70
    I'd be interested in this as well.
     
  3. HEROTECH70

    HEROTECH70

    Joined:
    May 24, 2017
    Posts:
    74
    it's already a miracle that you have a working catalog update
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
  5. unity_shane

    unity_shane

    Unity Technologies

    Joined:
    Jun 3, 2021
    Posts:
    102
    @Peter77 Hi there, unfortunately the behavior that you're describing is not possible with addressables as it is now. Because new catalogs are required to check the size of an update, and because UpdateCatalogs combines both downloading and updating the catalogs, once a user has updated the catalogs there is no way to "undo" the update and revert back to the previous state of the catalogs such as for the use case you described. That said, I talked about this with the team and we believe this is a good idea for a feature to support in the future. We've created a ticket for this and will make sure to take a look into it. Thank you for bringing this to our attention!
     
  6. NaijaNY82

    NaijaNY82

    Joined:
    Mar 7, 2017
    Posts:
    19
    Hey, has there been any updates/implementations or workarounds regarding this?

    I've tried GetDownloadSizeAsync() so many different ways but cant get it to work without updating the catalog first. Users should be able to view the download size and if there is enough storage space on their device then be given the option to update/download.
     
  7. warde

    warde

    Joined:
    Sep 10, 2012
    Posts:
    6
    1.19.19 now, still no luck:(
     
  8. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    804
    I managed to not make it auto download, but I'm not using UpdateCatalogs, I'm using LoadContentCatalogAsync. Then if the user selects not to download the update I call Addressables.RemoveResourceLocator(locator) where locator is the result from the LoadContentCatalogAsync returns.

    Now what I'm missing is being able to play with the already downloaded content instead.
     
  9. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    804
    Alright so I've been able to fix this issue with a custom solution. I know that @Peter77 already moved on from Addressables, but if anyone is still looking into some of the features mentioned on this thread you can see my solution here: https://forum.unity.com/threads/how...-loading-remote-catalog.1327674/#post-8397690 this is for remote catalogs built on a separate project. Haven't tested it with catalogs from the same project since I'm not using that workflow.
     
  10. NaijaNY82

    NaijaNY82

    Joined:
    Mar 7, 2017
    Posts:
    19
    Is there an update on the ticket that was created for this? Can users get a download size first in order to opt to download/update a catalog? Or to check if there is enough free space on the device before downloading/updating?