- Home /
How to determine validity of cached asset bundle
On launch, check if Asset Bundle is cached using Caching.IsVersionCached. Returns false.
Begin download of Asset Bundle using WWW.LoadFromCacheOrDownload
Close application before download finishes.
Relaunch application. Check if Asset Bundle is cached using Caching.IsVersionCached. Returns true.
Load unfinished asset bundle built with streaming scenes. Attempt to load a scene that was not downloaded. Fail
How do I check if the cached version is valid in step 4? Shouldn't Caching.IsVersionCached return false?
Answer by Jeff-Kesselman · Nov 12, 2014 at 06:56 PM
It would be nice if unity did something like CRC check on the downloaded data but Im not terribly surprised it doesn't.
I think you have two options:
(1) Write your own CRC check
or
(2) Catch the exception and invalidate the cache, then reload
If I wanted to write my own CRC check, I'd need access to the actual files (it creates separate files for each included scene). Is there a way to get the path to the bundle that you know of? Just checking to see if all of the files were present would be good enough for me.
How would you do number 2? I can't find anything online but here that even relates.