31-07-2019, 06:21 PM
(This post was last modified: 31-07-2019, 06:24 PM by josemendez.)
(31-07-2019, 04:16 PM)HenryChinaski Wrote: Thanks for the information. Could I ask you to elaborate shortly on the max timestep thing? Never changed that value. It is at the moment at 0.3333. I am targeting 30-45 fps.
I also attach a screenshot of the deep profiling. When trying to click on the "Show related objects" button, Unity crashes.
Simply comparing two objects for equality is taking up 61 ms, because FixedUpdate is called 16 times per frame, for a total of +40.000 object comparisons per frame.
From the profiler numbers I calculate you have around 652 mesh colliders in your scene, is that correct? Maybe you can merge some of them together, use primitive colliders (which are always much, much cheaper than MeshColliders)), or add/remove ObiColliders dynamically.
Max timestep is a pretty critical setting, as it controls how many times is Unity allowed to recalculate physics per frame, when the frame rate suffers a hit for any reason. A too high value can quickly spiral out of control and make performance plummet, if the physics recalculation itself takes more wall-clock time than the game-time it is accounting for. Ideally it should be set to a multiple of the fixed timestep. Eg: If you want to allow a maximum of 2 physics steps per frame and your fixed timestep is 0.02, set max timestep to 0.04. A max timestep of 0.33 allows for 0.33/0.02 = 16.5 steps before Unity gives up and starts the next frame, which is exactly what's happening here.