I have succeeded in loading the asset bundle using UnityWebRequestAssetBundle.GetAssetBundle().
If it's already in the cache, it loads from local, if not, downloads it from the web.
I don't want to start downloading immediately when AssetBundles are not cached locally.
I want the user to decide whether to download it now or not.
How do I pause when I need to download, and decide whether to proceed with the download now or not?
This is the current code.
IEnumerator DownloadAndCache()
{
string hash = "c1d228abfafede3d05affe6bd2e3b209";
Hash128 hash128 = Hash128.Parse(hash);
UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(uri, hash128, 3300783334);
yield return request.SendWebRequest();
GameObject cube = bundle.LoadAsset<GameObject>("Assets/Art/Event_test/EventMain3.prefab");
GameObject sprite = bundle.LoadAsset<GameObject>("Assets/Art/Event_test/EventMain2.prefab");
Instantiate(cube);
Instantiate(sprite);
}
question from:
https://stackoverflow.com/questions/65909060/is-it-possible-to-check-if-the-assetbundle-is-already-in-cache 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…