I'm working on a defense game that I need a way of knowing if every enemy in a wave is dead. I wanted to use a counter for it:
foreach (GameObject g in group1)
{
if(g == dead) {
deadCount++;
}
}
if(deadCount == allEnemiesInWave)
{
goToNextWave();
}
but I think it's not a safe or accurate way. Is there any better way?
Edit: This question is not like Check if all gameobjects are destroyed. In my question, I wanted to make a condition on many objects, in the other one, OP wanted to check if such objects existed.