Is there anyway to optimize my physics based game?

Sorry, my question is fairly vague. My game is about stacking objects. The problem is, while stacking high is not the only way to obtain points, it is still one viable way to get a high score in my game. This leads to many rigidbodies stacked on each other. I noticed on my phone that after stacking quite a few objects, the performance went down a bit. Not too much but still it was a noticeable drop. I assume performance will continue to go down as more objects are stacked. Did I just poorly design my game or is there something I could do when handling many rigidbodies? I’m trying to think of ways to keep my idea but I don’t want to players to be turned off by poor performance, it’s like they would be getting punished for doing good in the game. I’ve already made it a point to stay away from convex mesh colliders, all of my colliders are compound colliders or just a single primitive. I appreciate any suggestions, thanks.

Hey, I just ran into this same problem. My code isn’t quite complete so my GOs are all congregating on top of each other. When more than 4 end up at the same position, they game slows down to mud. It isn’t related to the number of objects either because if they are not stacked, the game runs fast.

I strongly suspect it is because each object has a mesh collider attached and those colliders are triggering themselves up the wahoo when they are stacked.

I suggest you turn off collision and triggering if possible when your items are stacked. After all, collisions are intended to bounce objects off each other.

Let me know if that worked.

Set Fixed TimeStep to 0.01 in Time Manager.

Consider:

function OnCollisionEnter()
{
   //if collision object is stackingObject
   //Parent Object
   //Make Kinematic
}

The problem could also be because of excessive draw calls. (Check the stats window in the Editor, next to Maximize on Play.) If the number for draw calls increases every time you add an object, you will need to consider sharing materials.