- Home /
Error when downloading AssetBundle from external server during runtime
I'm trying to download a 3d model with AssetBundle during runtime from an external Server. I created an assetBundle then I uploaded the AssetBundle file to an external Server.
Below is the code: // Use this for initialization void Start() { StartCoroutine("DownloadObject"); }
IEnumerator DownloadObject() { WWW www = WWW.LoadFromCacheOrDownload("http://infinitodesign.net/amir/dog", 1); //Download from server yield return www;
if(www != null) {
Debug.Log("wwww is empty");
}
AssetBundle bundle = www.assetBundle;//Get the AssetBundle
AssetBundleRequest request = bundle.LoadAssetAsync<GameObject>("dog");
yield return request;
GameObject dog = request.asset as GameObject;
Instantiate<GameObject>(dog);
}
When I run in Unity i discover that www is empty, failed to decompress data and Object reference not set to an instance of an object
Your answer
Follow this Question
Related Questions
Alternative to BuildStreamedSceneAssetBundle ? 0 Answers
Guideline 4.2.3-Design-Minimum Functionality 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Loading scene from assetbundle (url) 1 Answer