- Home /
Question by
$$anonymous$$ · Sep 09, 2020 at 04:47 AM ·
assetbundledownloadstorage
i want to download assetbundle from server once, and load from local storage every other time
i got the download from the server figured out
private IEnumerator DownloadBundle()
{
string site = "link to server";
UnityWebRequest www = UnityWebRequestAssetBundle.GetAssetBundle(site);
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(www);
GameObject obj = (GameObject)bundle.LoadAsset("Model");
Instantiate(obj);
bundle.Unload(false);
}
}
this instantiates gameobject into the scene, but when i change the scene and come back to that scene againt, it downloads the gameobject again, how can i load from local storage so it can work even with internet turned off?
while we are at it can i add another scene into the game through assetbundle ?
Comment
Your answer
Follow this Question
Related Questions
Write Downloaded AssetBundle to Local Storage 4 Answers
How Export and Downloading Asset Bundle at runtime? 0 Answers
Download an save assetbundle from server , on device Android and iOS 2 Answers
Caching Unity Web Request downloaded Asset Bundles denied by iOS 0 Answers
How to use asset bundle as database instead of PlayerPrefs 0 Answers