Quantcast
Viewing all articles
Browse latest Browse all 592

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: audio.Play(); 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?

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>