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 get list of downloaded asset bundles on Android/IOS

Discussion in 'Asset Bundles' started by peterkungen, Jul 21, 2017.

  1. peterkungen

    peterkungen

    Joined:
    Feb 5, 2015
    Posts:
    18
    Hi!

    As mentioned above, how do i get a list of downloaded asset bundles ON ANDROID & IOS?

    I Use WWW.LoadFromCacheOrDownload to download asset bundles. I need to create a list of those downloaded assets!


    So what I want is a function something like in C#


    for(i=0;i<Assets.DownloadedAssets().Length;i++)
    {
    Debug.log(Assets.DownloadedAssets i );
    }
    (of course That does not exist...)


    My secondary solution would be to add each assetbundle name to a list when I download them and use that file, but hope the above Idea is possible in some way!

    I also wonder, is the asset bundles saved to "Application.persistentDataPath" path by default? Is that something I need to consider or keep in mind???


    Thankful for any solutions or suggestions!

    Mvh Peter
     
  2. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    If you are using 2017.1 or later, you can use the Caching API (https://docs.unity3d.com/2017.1/Documentation/ScriptReference/Caching.html). Before that version, the only option is Caching.IsVersionCached, so would would need to create and maintain your own list of downloaded bundles in that case.

    As far as path locations go, the Caching system does not use the "Application.persistentDataPath" API directly as it has it's own internal cache path APIs that on some platforms is in a similar location while on other platforms not so similar. However on mobile, it still has the same limitations in that a user can clear an applications cached data and that would remove the bundles from disk.
     
    Saicopate, peterkungen and spryx like this.
  3. peterkungen

    peterkungen

    Joined:
    Feb 5, 2015
    Posts:
    18
    Alright, thank you for the answer, I have to look in to the new Chaching API. In my upcoming projects.

    for now I will go for a list.

    Peace out!