- Home /
Question by
maximus9600 · Jan 19, 2015 at 07:46 AM ·
vuforiaassetbundles
Loading a 3D object from Assetbundle mutliple times in different scenes
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));
}
}
Comment
Answer by maximus9600 · Jan 20, 2015 at 03:21 AM
Guys I solved it myself!!! Forgot to use bundle.Unload(). Now it works fine