Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Performance issues with Build Physics World

Discussion in 'Physics for ECS' started by Noctiphobia, Apr 30, 2023.

  1. Noctiphobia

    Noctiphobia

    Joined:
    Jun 9, 2021
    Posts:
    8
    I've been trying to figure out the performance issues for quite some time, without any success.
    I created around 60k entities - all of them are static and have simple colliders. There's only one object that they're actually able to collide with. This is networked, although again I'm not sure if this is actually relevant here.

    ServerWorld BuildPhysicsWorld takes around 70 ms, out of which apparently 45 ms is idle, 17 ms is AnalyticsJobs: PhysicsBodiesAnalyticsJob (whatever that is), and only 2.5 ms is Jobs:createRigidBodies (with everything else combined taking under 0.2 ms, and in some frames DispatchPairSequencer:RadixSortPerBodyAJob takes a few ms). Another 22 ms is in EndSimulationEntityCommandBufferSystem, almost all of that is idle too.
    In ClientWorld, BuildPhysicsWorld takes around 200 ms, with 133 ms idle, 52 ms on AnalyticsJobs: PhysicsBodiesAnalyticsJob, and 7 ms on Jobs:CreateRigidBodies.

    So, what is happening? Why is there so much idle time? What are those analytics jobs, is that debug info (that I could hopefully turn off, like I did with the integrity checks), or something actually needed? What can I do to make this actually work?
     
  2. alemnunez

    alemnunez

    Joined:
    Mar 15, 2023
    Posts:
    17
    Looks like PhysicsBodiesAnalyticsJob only happens in the editor and when the preprocessing symbol ENABLE_CLOUD_SERVICES_ANALYTICS is defined (it's guarded by
    #if UNITY_EDITOR && ENABLE_CLOUD_SERVICES_ANALYTICS)
    .
    I have been trying to remove that symbol so that those analytics jobs won't run, but couldn't find a way to do so. If anyone knows how to do that let me know. I don't need those analytics and the PhysicsBodiesAnalyticsJob is taking 2ms per frame and ruining the performance in the editor.
     
    PW_Avi likes this.
  3. sesky4_unity

    sesky4_unity

    Joined:
    Sep 1, 2019
    Posts:
    15
    same here,with 70k static colliders, BuildPhysicsWorld takes 700ms to run ( death spiral )

    any idea how to disable PhysicsAnalyticsSystem ?

    upload_2024-5-9_14-26-39.png

    upload_2024-5-9_14-13-46.png
     
    alemnunez likes this.
  4. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    329
    Note that this system is excluded in builds.
    We are looking at speeding it up at the moment. Enabling burst makes a big difference here also.
     
    alemnunez likes this.