How do i make an enemy spawn, then spawn the next?

Hello,

I need help on some script. All i need it to do is instead of randomizing what enemy it spawns i need it to spawn enemy 1 followed by enemy 2 after a delay say 5 seconds.

    public GameObject[] enemies;
     
    private void Start(){
    StartCoroutine("SpawnHandler");
    }
     
    private IEnumerator SpawnHandler(){
    float spawnDelay;
    int thisEnemy;
    GameObject cachedEnemy;
    float dieTime;
     
    while(true){
    thisEnemy = Random.Range(0, 0); //random enemy
    spawnDelay = Random.Range(1f,3f); //random time, from 1-3
    dieTime = Random.Range(3f,6f);

    // Unity forum: Ive tried adding an enemy here using 'nextEnemy = Random.range....
    // But no luck it just spawns the enemy here when i specify(1,1)

     
    yield return new WaitForSeconds(spawnDelay); //wait that time
     
    cachedEnemy = (GameObject)Instantiate(enemies[thisEnemy], transform.position, transform.rotation);//spawn enemy, cache him
     
    StartCoroutine(Kill(dieTime, cachedEnemy));
    }
    }
     
    private IEnumerator Kill(float wait, GameObject enemy){
    yield return new WaitForSeconds(wait);
    Destroy(enemy);
    }

Ive added unity forum where ive triedto add code but it did’nt work.

Really hope someone knows the answer, its the last one of the last things i need to workout!

Thanks,
Max

Dude, you asked this question six hours ago, and got an extensive answer for it as well.
http://answers.unity3d.com/questions/736440/spawning-enemies-at-random-times-so-close.html