Problem with including externel assets

Hi,

I’m trying to reduce my android app to < 50MB. So I collected all referenced objects from scenes, removed the scene itself form the list, created a asset bundle und build the android app. The one package size from about 80MB where split into about 38MB and 42MB. I put the asset bundle on a reachable web space. And here are my two problems:

1.) It seem that every time I start the app on my device the asset bundle will be downloaded again. Does anyone know how to download it only once? I’m using

var www : WWW = new WWW(url);
Debug.Log("Downloading!");
while( ! www.isDone )
{
    Debug.Log(www.progress);
    yield WaitForSeconds(1);
}

2.) When the asset bundle were downloaded I switch to the first scene but every thing is missing. I thought it’s enough to download an asset bundle and when the level is loading all assets were available. Did I forgot something?

Best regards
Martin

Can’t you just use PlayerPrefs to stop it redownloading?

For example:

var www : WWW = new WWW(url);
Debug.Log("Downloading!");
if(PlayerPrefs.GetInt("AssetsDownloaded") != 1)
{
   while( ! www.isDone )
   {
      Debug.Log(www.progress);
      yield WaitForSeconds(1);
   }
   PlayerPrefs.SetInt("AssetsDownloaded", 1);
}

As for the assetbundles not unpacking, I am curious as to the answer myself!

Hi,

good idea :smile: , but without adding asset bundle to all available resource I can’t check if the downloaded asset is still on sdcard.

So, does anyone knows how to add this asset bundle ?

Thanks
Martin

Check for WWW.LoadFromCacheOrDownload in unity’s scripting guide and look if it’s what you’ve been looking for.