How to Cache AssetBundles with UnityWebRequestAssetBundle

I was previously using WWW.AssetBundle as it works fine on Android and PC. However, moving onto iOS last I did not realize that iOS does not allow this command.

Therefore, I moved onto UnityWebRequestAssetBundle. While with WWW.AssetBundle it would cache my AssetBundles just fine. With UnityWebRequestAssetBundle using DownloadHandlerAssetBundle.GetContent it does not cache my AssetBundles to disk but rather to RAM.

Constructors
DownloadHandlerAssetBundle | Standard constructor for non-cached asset bundles.

I feel like I am using the wrong constructor because DownloadHandlerAssetBundles as stated above is one that does not cache. However, I am unable to find the correct constructor to use to cache my AssetBundles to disk that is not WWW.

Any help is appreciated. Thank you!

Have you tried scrolling down in the page that document DownloadHandlerAssetBundle? There are several versions of that constructor, most of them emply caching. UnityWebRequestAssetBundle.GetAssetBundle is a shortcut that create UnityWebRequest and DownloadHander for you, the same rules regarding caching apply.

1 Like