[SOLVED] Very low performance on simple entities with only 30 entity count DOTS + Physics

Hi folks,

Maybe someone here can enlighten me on what I might be doing wrong!

I implemented my game logic using mono behaviors but ran into performance issues when trying to spawn several instances of an object and thus I am going down the ECS route as that is supposed to be more performant.

The main issue I am having at the moment is with physics. I am literally only creating 40 entities with a couple of primitive colliders (BoxColliders) and mass to enable gravity but the framerate drops down to 1 or 2 FPS when it is going past 30 entities.

I have no other systems or behaviors in this project. I am creating the entities in the same spot so they drop in a pile. I don’t even have a graphics object attach or linked to them, they are pure entities with just PhysicsCollider, PhysicsVelocity, PhysicsMass, PhysicsGravityFactor, LocalTransform.

This is what the original object looks like, I’m using it as a reference to build the colliders for the entity:
Screenshot 2024-09-19 145102

Performance drawing with the Physics debug helper:

I already tried reducing the Solving iteration count to little improvement.

The challenge is that I am expected to be able to pile up around 1k entities for my game.

I only need these basic physics interactions (like gravity and collider) without any other fancy thing on top, is the unity version maybe too complex hence counter performant for this scenario? Is there an alternative anyone could suggest that would so the job well but with simple features that I can try?

Thanks in advance for any pointers!

Make sure Burst is enabled.

Thanks for the suggestion @Spy-Master but I have no jobs, systems, baking or anything like that. I just have a script that creates 30 entities 1 per second and adds the necessary components to get Unity Physics working!

Which is why I don’t understand how the application can get to 2 frames per second with only 30 entities when other folks talk about thousands.

The entities don’t even have a Graphic attached to them.

Show a screenshot of a frame in the Profiler. Specifically show the main and job (worker) threads.

I don’t know what it ended up being, I created a new project, copied the prefab and code to init the entities and now it performs much better. I can do 100 entities and framerate barely drops.