Best way to do efficient shell ejections?

Any thoughts on how to do gun shell ejections efficiently besides instantiating a rigid body, then adding the force and rotation to them. I’m developing a mobile game so I need to be efficient here. Open to any suggestions. Thanks!

As you noted, instantiating a new gameobject, attaching rigid body component and destroying it is a costly process every time you fire a bullet.

There are various way to optimise it. One simple way is if you know the maximum number of bullets that can be fired in your game before a bullet shell falls down (or disappears from player’s view), you can keep inactive bullet shells already loaded with all the components.

Activate it when a bullet gets fired and reuse them by disabling the object instead of destroying.

Since adding force to those shells again takes up plenty of resources, you can also animate the sequence of shell getting ejected (possibly 2 or 3 sequences and randomly picking one).

Hope it helps.

I would recommend using a particle system.
Depending the distance to the camera you can either use a sprite or a 3d model of a shell.