I am trying to call a coroutine that sets some variables, waits a few seconds, and then sets them back.
Unfortunately, the entire coroutine is firing all at once, without waiting. In this case, it's almost as if the function is never called at all.
public void Dash(){
lastDashTime = Time.time + dashWaitDuration;
motionBlur (); //this call is not working as expected
animator.SetFloat ("Speed", 0);
playerRigidBody.MovePosition (playerRigidBody.position + transform.forward * 1.75f);
}
//this is the coroutine
IEnumerator motionBlur(){
print ("Hello");
camMotionBlur.jitter = 10;
camMotionBlur.enabled = true;
yield return new WaitForSeconds (2);
camMotionBlur.enabled = false;
camMotionBlur.jitter = 0.125f;
}