Help have script know how many enemies are in the world

Hello, I am making this game where once a wave of enemies dies a new wave appears.
How do I code it so that my script on my spawner knows how many enemies are in the world and once they die, spawns new enemies.

Here is my spawn code

function SpawnEnemy() 

    //Instantiate the enemy prefab
   if (Spawn == true){  
    var enemyClone : GameObject = Instantiate(enemy, transform.position, Quaternion.identity);

create a list, every time you spawn an enemy, add them to the list, every time you kill one, remove them from the list.

That is if you need to know it live… if you just need to know it when you hit a button, just create an array with all the enemys in the sceen by declaring an array based on a tag and then count the array.

private List<GameObject> enemies;


Or if you tag your enemy game object with the tag “enemy” you use this. But do not use this on every frame b/c it is expansive to use the Find command.

void FindEnemies(){
    GameObject[] enemies = GameObject.FindGameObjectsWithTag("enemy");