I'm using UnityWebRequestAssetBundle.GetAssetBundle(url, bundleData.version, bundleData.crc);
system and I can successfully download and use bundleAssets online. But when I want to download multiple bundle assets and save them to use offline for later I have a problem.
I have 2 files for example, 'A' and 'B'.
Case 1: When I download A and go offline I can load A anytime even I close the app. But when I want to download B and come back to A can't load A again because it deletes cache for some reason and tries to download it again.
Case 2: When I download A and B together and go offline, if I load B it loads. But if I try A it can't load and needs internet connection. After that when I try to load B again I loose package so it needs internet connection again.
So basicly I want to download multiple asset bundles and I want to use them whenever I want. How can I solve this problem? Thanks.
Code example:
using UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle(url, bundleData.version, bundleData.crc);
yield return uwr.SendWebRequest();
bundle = DownloadHandlerAssetBundle.GetContent(uwr);
Debug.Log(bundle);
if (bundle==null)
{
Debug.Log("COULDN'T CONNECT TO URL");
callback(null);
}
else
{
Debug.Log("FOUND AT SEARCH!");
// Get downloaded asset bundle
bundle = DownloadHandlerAssetBundle.GetContent(uwr);
Sprite sprite = isDiff ? bundle.LoadAsset<Sprite>(levelText + "Diff") : bundle.LoadAsset<Sprite>(levelText);
callback(sprite);
}