Quantcast
Channel: Questions in topic: "assetbundles"
Viewing all articles
Browse latest Browse all 312

Caching Unity Web Request downloaded Asset Bundles denied by iOS

$
0
0
I have set up asset bundles downloads via Unity Web Request for a mobile app that I'm working on in Unity. The downloading and caching seems to work just fine in the Unity Editor but when I build the app and run it on iOS, I get this error: UnauthorizedAccessException: Access to the path "Saturday, September 14, 2019" is denied. This is in reference to the path that I'm generating based on the date of the download. Here is my code: public IEnumerator DownloadAndCacheMyaamiakiAssetBundle(string uri) { //Create new cache string today = DateTime.Today.ToLongDateString(); Directory.CreateDirectory(today); Cache newCache = Caching.AddCache(today); //Set current cache for writing to the new cache if the cache is valid if (newCache.valid) Caching.currentCacheForWriting = newCache; //Download the bundle UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(uri); request.SendWebRequest(); while(!request.isDone) { progress.fillAmount = request.downloadProgress; } AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request); //Get all the cached versions List listOfCachedVersions = new List(); Caching.GetCachedVersions(bundle.name, listOfCachedVersions); //This is if we only want to keep 1 local caches at any time if (Caching.cacheCount > 1) Caching.RemoveCache(Caching.GetCacheAt(1)); //Removes the oldest user created cache Since this code is just a modified version of the example given by Unity for Caching ([https://docs.unity3d.com/ScriptReference/Caching.html][1]) , I'm having trouble figuring out why iOS is denying me access to this cache file. Any suggestions? Thanks, Kurt [1]: https://docs.unity3d.com/ScriptReference/Caching.html

Viewing all articles
Browse latest Browse all 312

Trending Articles