Maximum Allowed Timestep
It is important to note that if a lot of time has passed since the last fixed update (for example, the game froze momentarily), then fixed updates will continue to be calculated within the same fixed update loop until the physics engine has caught up with the current time. For example, if the previous frame took 100 ms to render (for example, a sudden CPU spike caused the main thread to block for a long time), then the physics engine will need to be updated five times. The FixedUpdate() method will, therefore, be called five times before Update() can be called again due to the default fixed update timestep of 20 ms. Of course, if there is a lot of physics activity to process during these five fixed updates, such that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access