0

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

Amir Jaouani
  • 81
  • 1
  • 2
  • 6

0 Answers0