- Home /
Game "hiccups" when pooled game objects are used for the first time.
I pooled all my game objects upon level load expecting that it will smooth out my game play. Still, from time to time, when a new pooled object is brought into play for the first time, the game will stall for a fraction of a second before it runs smoothly again. It's not always the same object, nor does it happen every time -- just about half of the time on a fresh restart.
Just for good measure, I added code to perform manual GC and UnloadUnusedAssets after all my pooled objects are instantiated, and before game play starts but the hiccup still happens during play. I code in Javascript if that makes any difference.
What can I do? Not running Pro so I can't use the Profiler.
Thanks, Manny
We need to see code to provide more details.
One solution is to load all of you objects into the pool during a loading sequence, or at natural points where the game is paused.
Are you pre-loading the pool? Are the pooled objects physical? Inserting objects into the scene requires they are incorporated into the physics at various levels. Depending on where in the scene they're inserted, they can cause some pretty heavy reorganization of the underlying data structures.
It shouldn't matter that you are using Unityscript..
Do the pooled objects use shaders that need to be compiled as they are added to the world?
Your answer
Follow this Question
Related Questions
Particle system spawning a particle systems 0 Answers
enemy pooling 1 Answer
IOS Object Pooling 0 Answers
Which Implementation is Better? A Performance Question 1 Answer
Pooling or Instantiating Enemies? 2 Answers