Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Poor Sample Performance
#13
The second profiler pic clearly shows (in the Calls column) that FixedUpdate() is being called twice per frame, instead of just once. That’s why it takes twice the time.

In Unity (and all fixed-timestep engines), physics might be updated 0, 1, 2, 3... n times per frame, depending on how long the last frame took to render. This can result in a situation commonly -and jokingly- called “death spiral” or “well of despair”, where each frame takes longer to render than the previous one, forcing more physics updates, and even longer frames.

There’s multiple solutions to this: using a larger timestep, using a smaller max timestep, optimizing other parts of your game so that physics don’t have to be updated more than once per frame to catch up.

Read about fixed-timestepping schemes. It’s crucial to understand how they work to be able to profile and optimize physics in Unity (and many other engines)

Edit: here’s a really good (if a bit technical) explanation of different timestepping schemes, including fixed timestepping and death spiral: https://gafferongames.com/post/fix_your_timestep/
Reply


Messages In This Thread
Poor Sample Performance - by Armadous - 25-08-2018, 07:34 PM
RE: Poor Sample Performance - by josemendez - 27-08-2018, 06:37 PM
RE: Poor Sample Performance - by Armadous - 01-09-2018, 01:39 AM
RE: Poor Sample Performance - by josemendez - 01-09-2018, 09:14 AM
RE: Poor Sample Performance - by Armadous - 01-09-2018, 06:33 PM
RE: Poor Sample Performance - by josemendez - 05-09-2018, 05:05 PM
RE: Poor Sample Performance - by Armadous - 09-09-2018, 12:25 AM
RE: Poor Sample Performance - by josemendez - 09-09-2018, 02:49 PM
RE: Poor Sample Performance - by Evgenius - 05-09-2018, 12:37 PM
RE: Poor Sample Performance - by Evgenius - 06-09-2018, 08:30 AM
RE: Poor Sample Performance - by AppFreak - 06-09-2018, 06:02 PM
RE: Poor Sample Performance - by SyDRoX - 06-05-2020, 05:56 PM
RE: Poor Sample Performance - by josemendez - 06-05-2020, 07:09 PM