Asset bundles based game for Android

Hey!

I am making a game for Android and there is going to be a lot of downloable content (free) and I wonder how should I implement the downloading and reading process?

I have seen the Android games downloadind additional content but I have never see the content itself. Do they use some way to inject the data into the build itself?
Currently I am planning on making a small website with two functions:

  1. Giving the list of urls for downloading the assetbundles.
  2. Storing the assetbundles.

The game is going to work like this:

  1. When the game starts, it sends the request to the site.
  2. It gets the list of links as a response. If the asset bundle with the given name does not exist in the persistent data folder, it is going to download it.
  3. If the version of the assetbundle in the link is newer (no idea how to check it) it downloads the new asset bundle instead of current one.
  4. When the downloading process is finished, the game reads all the data from all the asset bundles.

But I don’t like this method. So, my question is: how to make a game which is build of downloable “levels”?

I hope my English makes sense.

1 Like

Unity has caching system, so its almost automatic (you try to download, it checks if server bundle is newer and not cached, then it downloads and caches it)

See,

Personally i made it so that,

  • when need to load asset bundle, load the .manifest first
  • get bundle hash value from the manifest
  • use that hash string as a parameter for UnityWebRequest.GetAssetBundle (then it will uses cached version if available already)

Hm… and if I press “Clear cache” in the software list, are those bundles going to be removed? And when are they stored after the download is finished?

Could you provide a sample of your implementation?

sure, i’ll try to post it later.

Not sure where or when they are actually stored, or if clear cache erases them…

check also unity tutorials about asset bundles,

sample source available, not actually tested this one (as its taken from some bigger script…had to remove some parts)
http://1darray.com/blog/2017/01/22/load-assetbundles-with-caching/