CreateRigidBodies runs for 500ms each frame

Hello,

I have a game with a simple grid with 100x100 tiles, each sporting a BoxCollider with IsTrigger checked. The colliders are there just to easily enable selection. The tiles are are not transformed in any way I can see.

When in editor, the game runs nicely with roughly 6ms per frame. When I build it however, it climbs to massive 716ms per frame. Most noticable here is the CreateRigidBodies job using all cores and still taking 463ms.

I found some topics about this, but got no wiser as to what can be done to prevent this. I could optimize the whole thing into having just one collider for the whole grid and calculate the cell being hit, but I don’t think this should take so long.

Does anyone know what am I doing wrong here?

It looks like Burst is disabled in the player. Make sure Burst is enabled for your build. Unity Physics is intended to be compiled with Burst to meet performance expectations. It also seems like you’ve got deep profiling on. That will drastically reduce the overall performance on top of running subpar Mono JIT-ed code.

1 Like