Why is it better to register a key press in Update but not in FixedUpdate?,

Hey guys, I’m a new to scripting. I was watching a tutorial to learn to make a jump key, which means the player will jump if i press space. Nevertheless, there’s one point I can’t understand. That the tutorial says that I should register a key in Update but not FixedUpdate, because i risk missing it in Fixedupdate. I consider the “miss” here means sometimes it won’t count when you press space because it runs too slow or lags, but I’m not sure. What causes this? FixedUpdate it’s more reliable and runs faster than Update, if I’m not wrong. Therefore, the chance FixedUpdate misses to count a key press should be smaller than Update. Then why is Update better for registering a key?
All in all, I’ve got two questions:

  1. What does the “miss” even mean?
    (If “miss” there means what I guessed) 2. Why should I choose FixedUpdate in this situation?

I extremely appreciate for your help. My English is bad so I couldn’t explain well.
A million thanks if anyone can help or suggest.

Link of that tutorial and when the question comes:

time: 1:06:41.

Thank you!!! :smiley:


Hi @REWWa,

This is due to the PlayerLoop execution order, which you can check here:

As you can see there, Input events are being called just before the Update, and FixedUpdate can be called multiple times until it comes to that. It can also be omitted at times. It can lead to double clicks or misses, depending on FixedUpdate frames since last Update.

Also FixedUpdate isn’t “faster” than Update. It’s fixed and always takes the same amount of time, which you can assign in the project settings under “Time” section.

So, we can get 60fps and 50physics fps – or another way, 30fps and 50physics fps etc.