StartCoroutine troubles, not delaying/

I have a sprite that goes through waypoints by the Patrol function. I have

transform.LookAt(target, Vector3.up);
velocity = moveDirection.normalized * speed;

Which controls the movement of the sprite, if I comment it out, my sprite does not move. But when I have a Co-routine right before it, which delays for 9 seconds, but it is not delaying anything (but it’s going into the coroutine as my “YEP” shows in debug)

if (delayWaypoint.Length > 0)
             StartCoroutine("checkForDelay");
transform.LookAt(target, Vector3.up);
velocity = moveDirection.normalized * speed;

and the coroutine code:

private IEnumerator checkForDelay()
    {
        int i = 0;
        foreach(int num in delayWaypoint)
        {
            if(num==currentWaypoint)
            {
                Debug.Log("YEP:" + delayAmount*);*

yield return new WaitForSeconds(delayAmount*);*

}
i++;
}
}
So when I run it, in debug this is shown “YEP:9” but nothing is delayed.

The code in a Coroutine after the yield return is going to run concurrently with the method that called it, So the delay effects code within the coroutine called after the yield.

If you simply want to delay execution for 9 seconds, take a look at Invoke.

Make sure you call your coroutine with :

StartCoroutine(checkForDelay());