I am trying to build an asset bundle loading solution that will work both online and offline.
I am able to download asset bundles with the WWW.LoadFromCacheOrDownload function but I’m having trouble loading them when there is no internet access.
First I download the main manifest file from the online location that contains the asset bundles. I then extract the names and Hash128s of the asset bundles from the manifest. I then use these values as the parameters in a WWW.LoadFromCacheOrDownload call to download the asset bundles from the internet. I am then storing these values in a local text file.
The plan is that when there is no internet connection I can load the names and Hash128s from the saved text file and use them as the parameters in a WWW.LoadFromCacheOrDownload call, it will recognise that the asset bundle is already downloaded and load it from the cache.
I have this all set up but the problem is with the Hash128 values. After retrieving them from the manifest I am converting them to a string in order to save them to the text file. When these Hash128s (that have been converted to strings) are read from the text file and parsed back into Hash128s they do not contain the original Hash128 value anymore. This means that the WWW.LoadFromCacheOrDownload function is not looking for the right asset bundle in the cache because the Hash128 that is used as the version is not the same, so it thinks there is a new version to download, which obviously doesn’t work when offline.
My question is this: is there a way to save a Hash128 value to a local file without converting it to something else first?
Or is my solution for this way off?
I am using Unity 5.0.2f1.
Thanks for any help!