I have a strange situation where when I show a game object on screen for the first time, like a small explosion, particle, object with attached lens flare, etc the frame rate drops for a split second causing touch control response issues.
If it were a card game, it wouldn’t matter much but – for an action, response sensitive game, it’s a total kill joy cause the player loses a life for no reason and that’s no fun.
Here’s the kicker, it only happens the first time that object is put into play. Because after that, when that object is activated again from the pool, there is no stall at all.
These are all small, pre-instantiated, pooled object – mostly simple particles or 2d explosions which only uses quads so it’s not like I’m suddenly adding thousands is tris to the rendering engine.
My draw calls is also very low. On average it the game coasts along with 9 or 10 draw calls per frame. So when I make alive a pooled particle system or 2d explosion with attached lens flare – I’m only adding, at most, 1 to 3 draw calls for a whopping total of ~13 draw calls. I did not think that was too much to handle.
I’ve double check to ensure that I am indeed using pooled objects and that the object scripts has no heavy duty code that does any major resource loading or doing any complex computations. By all measures, these are very light weight objects.
Again, it only happens the first time I use one of those pooled objects. All other subsequent uses has no issues at all.
This happens both in the Unity Editor play mode as well as in my final build running on iPad.
I tried using the Profiler on the trial license but could not find anything and now that trial has expired.
What’s going on?
Manny