unity destroy all objects with tag code example
Example 1: unity destroy all objects with tag
GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
foreach(GameObject enemy in enemies)
{
GameObject.Destroy(enemy);
}
Example 2: unity destroy all objects with tag
GameObject[] taggedObjects = GameObject.FindGameObjectsWithTag("Tag");
foreach (GameObject object in taggedObjects) {
Destroy(object);
}