Instantation Lag In Unity With Simple Game Object

I have a game object composed of 3 planes (with textures) a transparent cube, an empty with a box collider and rigid body, each enemy can instantiate 4 of these about every 50 tics.

Here is the code:

		for( var i = 0; i < guns.length; ++i ) {
			var shot = Instantiate( shotType, 
					guns[ i ].transform.position, guns[ i ].transform.rotation );

When I get about 10 enemies this lags a lot, can anyone tell me how I could possibly optimize this or what I can do about such a simple script so it does not lag?

You should be using a pool. A pool is a class that generates spare objects that can be used whenever they are needed, but instead of destroying them when they’re not needed anymore, you just deactivate them and add them back to the pool for further use.

That way, you avoid instantiating/destroying at runtime, which remains very expensive operations, even on basic objects.

This is not as complicated to implement as it sounds. Just look at this answer posted on another answer