Part of code in a coroutine is sometimes not executing correctly

Hello, I’ve been trying to figure out why this part of the code does not always execute as it is supposed to. I just cant figure it out, sometimes it works sometimes it doesnt

There are basically two possibilities. You have very small characters, or the loop is not firing.

Yep, debug your variables/conditions to make sure you are getting expected values back.

i have a feeling it’s because your waiting yield return new WaitForFixedUpdate();.

since you’re basicly waiting til the next frame. also

Waits until next fixed frame rate update function. See Also: FixedUpdate.

WaitForFixedUpdate can only be used with a yield statement in coroutines.

thats from the docs. i would just return it immendiately

i tried yield return null, still same

Characher is not small, and loop does fire but for a very short amount of time, and smooth damp’s smoothTimeTransitionY doesnt seam to be affecting the speed of the camera movement. I

I also now made this litle video just a walk through the code. Maybe this will make it easier for someone to tell me why this is happening

EDIT: oh and smoothTimeY doesnt affect the speed of the second loop

It looked like it happened when the character was jumping from what I saw. There is a max speed in the damp function which is set to infinity by default. Maybe if it was lower? I haven’t used that function much.