- Home /
Game slows down
hello i have made a 2d tower defense game but its slowing down in a function ontriggerstay()....i got to know through the profiler ..in that function its target the enemy and constantly checking its angle and according to that angle it sets its png and instantiate fire...please help me in optimizing this function..there are colliders on enemy and tower...
Is that for webplayer, mobiles, standalone ? What do you mean by png ? Approximatelly, how many objects with that OnTriggerStay do you have simutaneously (5, 20, 100, >500 ? )
Its for ios...and it has only 2 3 objects but it instantiate fire like a machine gun
Answer by Berenger · Mar 19, 2012 at 10:08 PM
My guess is that instatiating every bullet for a machin gun is killin your performances. Instead, you should instantiate every bullets, preferably in the editor, and use those repeatedly => You need one, set it visible at the correct position, add force, once it touches something make inactive again etc.
Hello i will implement this today...please be with me untill i solve the problem;)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Game runs painfully slow in Unity 0 Answers
Shorten C# Script 2 Answers
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers