Destroy a AssetBundle

Hi. Everybody.

I am trying to destroy an AssetBundle into my scene, but I haven’t a success. What is it wrong? I need to instantiate my enemy in a variable and after I can destroy it.

This is an example

//Before show
GameObject myEnemy = (GameObject)bundle.LoadAsset("enemy");
Instantiate (myEnemy, new Vector3 (coordX, coordY, coordZ), Quaternion.identity);

//After Destroy
GameObject myEnemy = Instantiate(myEnemy);
Destroy(myEnemy);

Thank You

You are instantiating it it twice, then deleting the new copy, leaving the old one.

Remove the code referenced from line 7 above. That simply makes yet another copy of the enemy.

Don’t spam topic tags please; it’s useless and annoying. None of them have anything to do with your topic, aside from “csharp”, so I removed them.

–Eric