- Home /
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 :)
Answer by Aleron · Dec 02, 2011 at 04:42 PM
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:
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
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
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.
Your answer
Follow this Question
Related Questions
how to unload asset when load new scene? 0 Answers
Unload asset bundle make problem 0 Answers
How to use Resources.UnloadAsset 1 Answer
Sending logs over the Internet 1 Answer