- Home /
Best Answer
Answer by adrenak · Sep 07, 2012 at 07:42 AM
Just get an array of objects with the tag you want and destroy them one by one
var gameObjects : GameObject[];
function SomeFunction(){
gameObjects = GameObject.FindGameObjectsWithTag ("yourTag");
for(var i = 0 ; i < gameObjects.length ; i ++)
Destroy(gameObjects[i]);
}
I Hope this works!
Answer by DGDGJOHN · Jun 03, 2014 at 05:51 PM
CONVERTED TO C# GameObject[] gameObjects;
void DestroyAllObjects()
{
gameObjects = GameObject.FindGameObjectsWithTag ("yourTag");
for(var i = 0 ; i < gameObjects.Length ; i ++)
{
Destroy(gameObjects[i]);
}
}
Your answer
Follow this Question
Related Questions
Destroy objects by clicking on them 1 Answer
Destroy All of One One object on collision 1 Answer
Destroy only selected object 1 Answer
Destroy all objects in the scene? 0 Answers