- Home /
Question by
Slence · Mar 26, 2014 at 10:57 AM ·
gameobjectinstantiatetimeamount
Instantiate for amount of time
I have the next code to instantiate an special attack (gameObject):
Instantiate(Resources.Load("Attack1"), new Vector3(opponent.transform.position.x, opponent.transform.position.y + 1.5f, opponent.transform.position.z), Quaternion.identity);
The problem is, everytime I run this code, it obviously keeps creating clones of the gameobject. Now my question is, how can I destroy this gameobject for example every 1 second after it instantiates?
Thanks for reading!
Comment
Best Answer
Answer by Eric5h5 · Mar 26, 2014 at 10:59 AM
var go = Instantiate (prefab);
Destroy (go, 1.0f);
Your answer
Follow this Question
Related Questions
Instantiate clones with error. 1 Answer
Instantiated Objects not being set at ground/terrain level?(Solved) 1 Answer
Unwanted 2nd empty gameobject 1 Answer
Every NetworkViewID is 0? 0 Answers
NavMesh giving jerky like motion 0 Answers