Doing a runner game here, How do i spawn another path attaches to the current path via IEnumerator?


public Transform leftTileCurve;
private Vector3 leftCurveSpawn;
private Vector3 NextLeftSpawn;
IEnumerator spawnLeftTile()
{
    yield return new WaitForSeconds(0.5f);
    Instantiate(leftTileStraight, NextLeftSpawn, Quaternion.identity);
    NextLeftSpawn.z += 20;
    if(nextTileSpawn.z > 60)
    {
        Instantiate(leftTileCurve, leftCurveSpawn, Quaternion.identity);
        NextLeftSpawn = leftCurveSpawn;
        leftCurveSpawn.z += 20;
    }
    StartCoroutine(spawnLeftTile());
}

The "leftCurveSpawn" spawns right at the beginning which is vector (0,0,0) instead of the continuation of "nextLeftSpawn".