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

How to check status of Addressables (Downloaded/Cached/None)

Discussion in 'Addressables' started by Cfirzi, Oct 17, 2019.

  1. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    I try to find the correct way to check is Addressable Asset have been downloaded to my local storage and if it is loaded to cache (separated checks) or not.
    At the moment the only answer I have found in the forums is to use Addressables.GetDownloadSize(AddressableScene) and if it returns 0 than it means that it was downloaded (...?)
    When tested it was inconsistent on Mobile device and in Editor.

    Thanks in advance !
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    You have to rely on GetDownloadSize, 0 means nothing to download (== downloaded / cached). It resolves the dependencies for you. If you find the api is inconsistent between android and editor, please report a bug to unity.
     
    phobos2077 and Cfirzi like this.
  3. Cfirzi

    Cfirzi

    Joined:
    Jul 30, 2018
    Posts:
    24
    Thanks !
    And just to be sure, this is the intended solution or is it a temp solution until Unity implement a different API for it ?
     
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    I don't remember there's discussion about adding new api for such purpose. But you can propose RFC if you think it's better to have it.
     
    phobos2077 and Cfirzi like this.
  5. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    In Addressables 1.11.2,
    Addressables.GetDownloadSizeAsync(key) 
    always return the actual file size even if the asset has been downloaded. I am trying to find an alternative way to check if an asset has been downloaded and cached.
    Caching.IsVersionCached(key, new Hash128());
    may does the thing, but its second parameter requires the hash code of the bundle, I don't know how to get the hash code. Can anyone help?
     
    Xarbrough likes this.
  6. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    This is clearly a bug. Can you send a bug report via Unity bug reporter? I'm relying on this behaviour for some loading logic. Now I'm hesitant to update to the latest version :(
     
  7. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    Has anyone reported this as an issue in the meantime? If not, I'll do so tomorrow.
     
  8. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    I didn't. Please do. They've released another update but no mention about this issue being fixed. Very sad. Not only the whole Download Bundles feature is half-baked, but now they break it completely and ignore the reports on forums... I wonder if they have a dedicated team working just on Addressables alone, how hard it is to take a peek at forums once in a while to see what issues people find and what they are struggling with.

    These are still early days of Addressables and it's important to gather as much info as possible before doing 2.0. Yet there's no signs of devs here :(
     
  9. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I've reported case 1264020 and will post here when I receive a reply.
     
  10. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188