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

Bug Addressables.GetDownloadSizeAsync() returns 0 when IResourceLocation.HasDependencies = false

Discussion in 'Addressables' started by mulova, Apr 12, 2021.

  1. mulova

    mulova

    Joined:
    Apr 14, 2011
    Posts:
    62
    According to the source code from AddressablesImpl.GetDownloadSizeAsync()
    Code (CSharp):
    1. foreach (var loc in locations)
    2. {
    3.     if (loc.HasDependencies)
    4.         allLocations.AddRange(loc.Dependencies);
    5. }
    For an AssetBundle containing no dependencies returns size 0.
    Is it intended?
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
    I'll flag with the team for their input. Which version of Addressables are you using?
     
  3. mulova

    mulova

    Joined:
    Apr 14, 2011
    Posts:
    62
    Thank you a lot. I used the latest. 1.17.15.
    As a side note, I called AddressablesImpl.GetDownloadSizeAsync() with the IAssetBundleResource object instead of address.
     
  4. andymilsom

    andymilsom

    Unity Technologies

    Joined:
    Mar 2, 2016
    Posts:
    294
    Passing an IAssetBundleResource object to GetDownloadSizeAsync is not expected. This Object is the result of a download operation, of such I am quite curious what is it you are looking to do?
    GetDownloadSizeAsync is expecting a Location of a bundledAsset, which then gets their dependency AssetBundle locations to get the download size
     
  5. mulova

    mulova

    Joined:
    Apr 14, 2011
    Posts:
    62
    I wanted to select which bundles download in advance by the name filter.
    So I collected the IAssetBundleResource list to download and called the GetDownloadSizeAsync with them.
    Now I found the workaround. Collecting the keys which have the dependencies for the bundles and it worked.
    So never mind about this issue.