- Home /
Sudden frame rate drops on mobile when instantiating/destroying?
I am currently working on a mobile game and I can't help but notice that whenever an object (an obstacle in my case) is instantiated or destroyed, I get a sudden FPS drop which is critical for my gameplay.
To help give an idea, I instantiate obstacles on top of my screen every 1.5 seconds, then I scroll them down. If the obstacles reaches the bottom of the screen already, I destroy them to prevent memory leaks/waste.
I'm still pretty new to Unity development. Am I on the right track though? What is a better solution to prevent this sudden frame rate drop?
Any help is appreciated!
Answer by Meltdown · May 09, 2015 at 07:32 AM
Instantiate and destroy are expensive operations, and should be avoided at runtime where possible.
I would suggest looking into Object Pooling.