- Home /
Why use Update and not FixedUpdate()
I understand that physics calculations should be done in FixedUpdate(). But if one uses FixedUpdate() why not put all their update logic in there? Why use Update() ?
Answer by Eric5h5 · Mar 15, 2017 at 08:43 AM
You should not use FixedUpdate because it doesn't run every frame. So movement will be jerky, one-time input events such as GetButtonDown will be missed randomly, and so on.
Answer by AurimasBlazulionis · Mar 15, 2017 at 08:21 AM
Update is frame rate dependant and FixedUpdate is run at fixed rate. Update is useful when you do not need 100% deterministic results, it most of the time is called less (when the framerate is less than 50 by default). Also, FixedUpdate does not always work with input handling.
In short: if you do not need deterministic results, do not work with fixed rates in networking, use Update.
FixedUpdate isn't 100% deter$$anonymous$$istic either. It's only sort of fixed; depending on how stressed the CPU is, it won't run as many times per second as specified. It's really only for physics.
If FixedUpdate slows down, so should the game clock. So the game would still be deter$$anonymous$$istic, just slower.
it's not 100% deter$$anonymous$$istic, sorry. If you attempt to make game synchronization code based on FixedUpdate, don't blame me when your players get upset. ;)
Your answer