- Home /
Download an save assetbundle from server , on device Android and iOS
How do you save a assetbundled has downloaded from server and save it on Android or IOS , actually i use this code only for download, but for save it i dont know what can i do, i was tryit with "playerpref" and "document.write" but for this its dosent work because is only for desktops app
Download code:
IEnumerator DownloadModel()
{
using (UnityWebRequest uwr = UnityWebRequestAssetBundle.GetAssetBundle(url))
{
yield return uwr.SendWebRequest();
if (uwr.isNetworkError || uwr.isHttpError)
{
Debug.Log(uwr.error);
}
else
{
bundle = DownloadHandlerAssetBundle.GetContent(uwr);
g = Instantiate(bundle.LoadAsset("ARContent.prefab")) as GameObject;
g.transform.parent = ImageTarget.transform;
g.transform.position = ImageTarget.transform.position;
bundle.Unload(false);
//Instantiate(g);
}
}
}
Answer by revolute · Dec 31, 2019 at 02:28 AM
GetAssetBundle() will cache it. Unity will cache it on the local device, you only need to provide it with url, perhaps crc and/or version to make Unity download a newer version of assetbundle.
Simply put, GetAssetBundle() will download the bundle on the first run, from then on GetAssetBundle() will load from the local cache.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220828im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Save progress in WebGL game (C#) 1 Answer
Alternative to BuildStreamedSceneAssetBundle ? 0 Answers
Guideline 4.2.3-Design-Minimum Functionality 0 Answers
Saving progress even when I quit the windows app 0 Answers
Multiple Cars not working 1 Answer