Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WaitForAllTasks randomly uses too much CPU, and performance optimization suggestions
#2
Hi there!

Sorry for taking some time to reply to this, but that was a long post to read!Guiño

Regarding the WaitForAllTasks spikes: this method is where the physics computation itself takes place. It runs by default in FixedUpdate, which is usually called only once per frame but can be called by Unity as many times as necessary to get the physics update to be in sync with the game world's time. If for some reason a given frame takes longer to render, the next frame will call FixedUpdate multiple times.

This behavior is completely normal in all fixed-timestep physics engines (and should be expected). The maximum amount of  time that is spent in physics in any given frame can be capped in Unity: ProjectSettings->Time->max fixed timestep. Note that in some less powerful devices, you can enter a situation known as the "death spiral", see the following video for my pitiful attempt of an explanation:



Performance tips:
- Use "line" rendering mode with the line material provided for much cheaper rope rendering (camera oriented triangle strips instead of full-3D extruded geometry).
- Use low rope resolution values (less particles will be generated) and crank up rope smoothing to compensate.
- Use less distance constraint iterations, and use a couple substeps instead.

We are currently polishing Obi's collider system, so expect compound colliders to be back in the next version.
Reply


Messages In This Thread
RE: WaitForAllTasks randomly uses too much CPU, and performance optimization suggestions - by josemendez - 02-05-2018, 04:02 PM