Quoting from the asset bundles documentation ( Unity - Scripting API: Networking.UnityWebRequestAssetBundle.GetAssetBundle )
“Note, that while you can use this API to load Asset Bundle from local storage (using file:// URI or jar:file// on Android), this is not recommended, use AssetBundle.LoadFromFileAsync instead.”
But this doesn’t explain why isn’t recommended. Is it performance related?
I mean, isn’t this the “way” to load asset bundles using disk cache?
If you download a bundle thats already on the filesystem, would it not then be duplicated and therefor utilise two times the amount of disk space?
As in, lets say I have a bundle in streaming assets which I load via the GetAssetbundle unitywebrequest. I’m guessing it now exists twice, once in cache and once in the streaming assets folder.
You are correct, it will exist in the streaming assets folder and it also be uncompressed on the asset bundle cache
Unless, I suppose, you don’t pass in a hash or version number. According to the documentation that will skip the caching mechanism entirely.
Correct, if you specify only the path/URI, asset bundle will be loaded, but not cached.
Loading asset bundles using AssetBundle.LoadFromFileAsync ir more efficient than using UnityWebRequest, that’s why it is discouraged.
Even after it’s cached? (So on the second call to UnityWebRequest)
If it’s cached using built-in caching system, then that is how you load a bundle from cache - do the same UnityWebRequest.
The discouragement is specifically for local asset bundle files. If file is local and you don’t use caching, then by using UWR you are simply paying extra price for nothing.
Maybe in theory AssetBundle.LoadFromFileAsync is faster , but in practice on Android it is unusable.
That should not be true. It should load asset bundle fine on Android.
More users are complaining about this on Android , without enabling “Use UnityWebRequest for local bundles” option , the Addressable system is unusable , but the problem is that by enabling this option will duplicate the bundles , which is a big problem because in my case the game almost doubles in size.