Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Why my Physics.Processing takes 100ms? Here are my scene stats.

Discussion in 'Physics' started by nina32176, Nov 16, 2023.

  1. nina32176

    nina32176

    Joined:
    Jun 27, 2018
    Posts:
    17
    On unity 2023.3.48f1, in editor, and in windows build, havent tested anything else.
    Here is profiller screenshot:

    Here are physics stats:
    upload_2023-11-16_10-34-18.png
    upload_2023-11-16_10-34-33.png
    What is taking so much time? How to investigate?

    Here is another screenshot:
    upload_2023-11-16_10-35-13.png
    What's going on? What is taking 54ms in Physics.Processing?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,140
    I'm not on the 3D physics team but one observation here is that the PlayerLoop is calling FixedUpdate twice so anything (including) physics runs twice so that figure at a guess would be half that but yes, still a lot of working going on if it's all static colliders only albeit a lot of them. I did see a Kinematic so not sure what that is about, presumably a character? It's not overlapping lots of these statics is it causing a lot of work? Just guessing really.

    FixedUpdate is trying to maintain the rate given the circumstances.

    Just an observation though! :)
     
  3. nina32176

    nina32176

    Joined:
    Jun 27, 2018
    Posts:
    17
    Ok so here is more information:
    - there is one character controller in the scene that I move with Move
    - here are timestep settings (I tried to lower them):
    upload_2023-11-16_11-57-24.png
    - the problem does not seem to corelate to the number of colliders, because in the next frames I can see it takes 1ms:
    upload_2023-11-16_11-59-12.png
    See the image above, it seems there is no corelation between number of statics and framerate.

    So far I would really kindly ask you (I mean, anyone from Unity) to tell me what is taking that 50ms so I can optimize. I can't optimize if I don't know what's taking so long, I have many processess running that are highly optimized already with profiller...

    Some more information about my use case: I am creating my scene on the fly, but everything is pooled, well, maybe except the mesh collider verts data. Is it possible that SOMEHOW activating a gameobject with collider causes this spike? Or setting mesh collider tris? But please note - the spike comes from Processing, not from gameobject activate, not from mesh cooking, etc, etc, etc.

    I have also tried to change some broadphrase settings, no luck, all the same
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,140
    No idea, as I said I'm not really a 3D physics dev. The views you're posting just back the time you say, they don't offer any actual additional information really.

    There's a bunch of threads such as this one: https://forum.unity.com/threads/uni...proccesing-rendering-spikes-and-more.1056236/

    Some seem to indicate specific reports where it was time reported waiting on thread jobs due to "weaker hardware". I presume that kind of waiting would be clearly shown in the CPU timeline view.

    Again, I'm just the messenger here. :)