Performance degradation of BuildPhysicsWorld with Entities 0.5.0

A few day ago I switched to Entities 0.5.0. And now I came across a problem with frame by frame performance degradation.
To reproduce:

  • just put empty game object and add Physics Body and Conver To Entity components.
  • open profiler
  • run

GC.Collect is called more and more often, but I didn’t find that on 0.4.0

Initial screen:

After ~30min:

My setup:

Disable leak detection. in the jobs menu.

@Joachim_Ante_1 Thank you for your reply.

  • I created a new empty project
  • Installed all necessary packages
  • Turned off leak detection
  • Turned off Jobs Debugger
  • Created empty GameObject on the scene
  • Added Physics Body + Convert To Entity to it
  • Run
  • Wait ~15min

Performance downgraded from 800 FPS to 150 FPS

My setup:
Unity 2019.3.0f5
manifest.json:

{
  "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.burst": "1.2.0",
    "com.unity.collab-proxy": "1.2.16",
    "com.unity.entities": "0.5.0-preview.17",
    "com.unity.ide.rider": "1.1.4",
    "com.unity.ide.vscode": "1.1.3",
    "com.unity.physics": "0.2.5-preview.1",
    "com.unity.test-framework": "1.1.9",
    "com.unity.textmeshpro": "2.0.1",
    "com.unity.timeline": "1.2.9",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

Result profiling:
5393157--547044--Degraded-2.png

Thanks

@Yuriy_Sevastyanov Can you check your entities debugger whether it may be related to [Case 1212334] PhysicsStepQuery in BuildPhysicsSystem being recreated excessively ?

@florianhanke It looks like the same issue. I can see a lot of PhysicsStep

The GetSingleton perf issue should be fixed in the next entities release.
Sounds like its related to this.

5 Likes

Thanks!

Is there a patch we can apply in the meantime?

1 Like