0

I created an asset bundle for one of my 3D assets and also tested by downloading that bundle at runtime its working fine. Now I want the same procedure of asset Bundling in ARCore. I want to load Andy 3D asset not as prefab but as AssetBundle from an external server. And I tried AssetBundling in ARCore but it is not working.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using UnityEditor;

public class DownloadAssetBundle : MonoBehaviour {
    public static DownloadAssetBundle instance = null;
    [HideInInspector]public string url;
    [HideInInspector]public GameObject assetDemo;
    // Use this for initialization
    void Awake()
    {
        if (instance == null)


            instance = this;


        else if (instance != this)

            Destroy(gameObject);
    }
    void Start () {
        url = "https://s3.amazonaws.com/bucketname/myasset";
        StartCoroutine (DownloadAsset());
    }

    IEnumerator DownloadAsset()
    {
        WWW www = new WWW (url);
        yield return www;
        AssetBundle assetbundle = www.assetBundle;
            assetDemo = (GameObject)assetbundle.LoadAsset ("DinningTable");
            //Instantiate (assetDemo,Vector3.zero,Quaternion.identity);

    }
}

By using above code I am downloading AssetBundle form my AWS S3 bucket and I also created the instance for this script because I want to instantiate "assetDemo" variable gameobject in ExampleController and I did that also

andyObject = Instantiate(DownloadAssetBundle.instance.assetDemo, hit.Pose.position, hit.Pose.rotation);

But it was not working!!! can anybody help me out of it

Akhil Gudimetla
  • 342
  • 3
  • 11

0 Answers0