Is it right to Unload assetbundle?

Hi,

I download my assetbundle like this in webplayer platform.

WWW data = new WWW(URL);

And I unload assetbundle like this.

data.assetBundle.Unload(false);

Is this way is right?

In addition, I wonder how to know assetbundle is downloaded already.

Is method exist to know that?

Thanks :slight_smile:

To use Unity’s built in caching mechanism for asset bundles and such you can use:

WWW data = WWW.LoadFromCacheOrDownload(URL, <current version>);

Tracking the version can be done several ways:

  1. Manually update your code when you create a new version of the asset bundle and place it on the server, but that requires releasing a new build of the game
  2. Store the current version of the bundle in a text file on a server and have the game download that and parse the version out of it
  3. Store the current version of the bundle in a database on a server and have the game retrieve it from there

And yes, the Unload call is correct if you aren’t using the assets from the bundle right away. When you want to use its assets you will need to load it again either by making a WWW call to load the local file (using file://) or if you use LoadFromCacheOrDownload it will check if the file already exists in the local cache and load it from there instead of downloading it again.