Can't kill multiple enemies whom are using the same tag..

Hey guys, I can’t kill multiple enemies who are using the same Tag.

There’s an order that I have to kill them in.

For example, I have two enemies on scene who are using the same tag “Enemy”.

In order to kill Enemy#2 I must kill Enemy#1.

Does any know a fix for this.

I’ve tried putting my enemies in to an array.

        GameObject[] arrayOfGameObjects = GameObject.FindGameObjectsWithTag("Enemy");

But the next bit is how can I use that array as a resolve.

Will be grateful for responses.

Thank you.

For loop would be great.

for (var i = 0; i < arrayOfGameObjects.length; i++) {
Destroy (arrayOfGameObjects[i]);
}

Instead of Destroy you can add anything you want. Like dying animations.

Remember that arrayOfObjects is a way to access every single game object with this tag and apply some action to it. Like move by 2 units, scale them or change colors etc.