IEnumerator showTextFuntion(int[] quantity, string[] types) { for (int index = 0; index < types.Length; index++) { for (int q = 0; q < quantity[index]; q++) { generating = true; Debug.Log("oi"); spawn.spawnEnemy(getEnemyType(types[index])); yield return(new WaitForSeconds(3f)); Debug.Log("Tchau"); generating = false; } } }