I have an AssetBundle for a 3d object. In Vuforia, when one Image target is detected I want it to load the scene that will show me the downloaded 3d object. This works for me if I run the script once.But when I go back to the camera view and again detect the image target,I am not able to get the object. How do I make it in such a way that the object is loaded and displayed everytime the image target is detected without re-starting the app.
This is my code:
AssetBundle bundle;
void Start()
{
StartCoroutine("Download");
}
IEnumerator Download()
{
url="http://myurl";
WWW myasset= WWW.LoadFromCacheorDownload(url,1);
yield return asset;
bundle = myasset.assetBundle
if(Assetname=="Box")
{
bundle.LoadAsync(Assetname,typeof((GameObject));
Instantiate(bundle.Load(AssetName));
}
}
↧