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.