Open iBicha opened 6 years ago
There is no profound reason. We just didn't include it in the official release because it didn't get enough testing. Particularly, it's hard to judge what the size of the cache should be since phones have widely different storage capacities so while a 2GB cache may be reasonable on a 64GB phone, it's not so reasonable on a 16GB phone.
I see. I left the default to 512MB, and it kinda worked. I did notice something really strange though. (I didn't open an issue, since it is not officially supported yet) but here it is:
After allowing cache on mobile:
bool cacheSupported = Application.platform == RuntimePlatform.WindowsEditor ||
Application.platform == RuntimePlatform.WindowsPlayer ||
Application.platform == RuntimePlatform.OSXEditor ||
Application.platform == RuntimePlatform.OSXPlayer ||
Application.platform == RuntimePlatform.Android ||
Application.platform == RuntimePlatform.IPhonePlayer;
and my cache path is
string defaultCachePath = Path.Combine(Application.persistentDataPath, "WebRequestCache");
a PolyListAssetsRequest
with keywords
succeeds on both desktop and Android. But a PolyListAssetsRequest
without keywords, and curated
set to true, succeeds on desktop, and fails on Android with a 500 Error (which is really weird, because I don't know what a server error has to do with caching)
So the fail conditions are:
On mobile (tested on Android)
Cache enabled
curated
set to true
Edit:
BufferHolder.tempBuffer
and BufferHolder.dataBuffer
are used nowhere in the project, I set both TEMP_BUFFER_SIZE
and DATA_BUFFER_INIT_SIZE
to 0.
That solved the problem. (probably related to an out of memory exception, that Unity reported as a 500)
Also, a couple of useful resources for this matter:
https://docs.unity3d.com/ScriptReference/Cache.html https://docs.unity3d.com/ScriptReference/Caching.AddCache.html https://docs.unity3d.com/ScriptReference/Application-temporaryCachePath.html
Nice! This is really useful info. Thanks for investigating!
Oh I just wanted to rectify this and I forgot, I was wrong about caching, since it is specific to asset bundles, and not arbitrary downloaded files. But the temporaryCachePath can indeed be used for caching (I think it is the preferred way, as it can be cleared from the app info in android for example)
Is there a reason why caching is only on Desktop? I did a few modifications and caching works on mobile. Is there something I'm missing?