Following Unity's advice, *starting Unity 5.3, it is strongly recommended to use [UnityWebRequest][1]* -rather than [WWW.LoadFromCacheOrDownload][2]- to download AssetBundles from a server. However, we also need to store the downloaded bundles locally (via [Application.persistentDataPath][3])... but how??
*WWW.LoadFromCacheOrDownload* provides you with a *byte[]* that could be saved/loaded. Unfortunately, accessing the *data* field in [DownloadHandlerAssetBundle][4] is not allowed and triggers an exception. Is there any way to access/save the downloaded data using UnityWebRequest? Or are we forced to go back and use *WWW.LoadFromCacheOrDownload* instead?
PS - We are aware of the Caching functionality, but we want to store it locally.
[1]: https://unity3d.com/learn/tutorials/topics/best-practices/assetbundle-fundamentals?playlist=30089#AssetBundleDownloadHandler
[2]: https://unity3d.com/learn/tutorials/topics/best-practices/assetbundle-fundamentals?playlist=30089#WWW.LoadFromCacheOrDownload
[3]: https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiTg6ffl8HPAhVeF8AKHcUMA_IQFggeMAA&url=https%3A%2F%2Fdocs.unity3d.com%2FScriptReference%2FApplication-persistentDataPath.html&usg=AFQjCNEyIg37Lm58ZPGFTDTD4Z2VBuBRfQ
[4]: https://docs.unity3d.com/ScriptReference/Networking.DownloadHandlerAssetBundle.html?_ga=1.146998647.1107998625.1470040586
↧