- Home /
How to destroy more than one clone at runtime???
for (int i=0;i<5;i++) { Destroy(GameObject.Find("bullet(Clone)")); }
I used this code.but it destroy only one clone not 5.
Answer by Jeff-Kesselman · May 07, 2014 at 01:49 PM
Thats because the object doesn't get destroyed til the next frame, so you keep destroying the same object. Give your bullets a tag and use https://docs.unity3d.com/Documentation/ScriptReference/GameObject.FindGameObjectsWithTag.html
Thats also a lot more efficient.
Alternately you could "try" http://docs.unity3d.com/Documentation/ScriptReference/Object.DestroyImmediate.html
Im not sure exactly how immediate that is, though.
Your answer
![](https://koobas.hobune.stream/wayback/20220613144446im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I Destroy() powerup and get sound to play? 1 Answer
How do you destroy respawned clones? 1 Answer
How can I destroy my Instance without renaming it? 2 Answers
error in destroying bullet prefab 1 Answer
restricting clone number 2 Answers