- Home /
iOS Game freeze, when particles emitted for first time.
Hello.
I'm building a puzzle game, where on a certain point, particle emitter emits about 30 particles (Blowing stars). When i run the game for first time on iPAD, on the verry first particle emission, the game freeze for a fraction of a second. It's allmost not noticeable on iPad 4, but it is on iPad mini and iPod 5.
This happens only when the game runs for first time (Meaning if you close (Not suspend) the game and then run it again it does it again on the first particle emission). After that all emissions run smoothly with absolutely no slowing...
Is there something i can do about this? Are the particles a lot? I mean 30 particles doesn't seem a lot... The particles have matterial with a texture of small star, so it's like blowing stars..
Thanks
Answer by MD_Reptile · May 17, 2013 at 02:31 PM
Thats probably caused by the game first loading the resources to run the particle, not so much the particle happening, just the lag of loading up its texture and settings.
You could probably just have your emitter running somewhere hidden, and that way the lag happens when you very first load the level (normal stuff for games) and then, disable it, and move it to the position where it will actually be used, then re-enable at the right time.
That way, the lag would be over with before the player is engaged in the actual level. This is a good idea to apply this sort of thing in games with lots of unique instantiation/particles/anything...
Thanks :) I was thinking to add one other emitter, that emits particles to the side of the screen.. But would that be countered as emitting, if it's not infront the camera? Or maybe i shoud do it behind the background of the game...
I would just do it somewhere behind the camera, completely out of view, then shut it off, and move back to its actual position, waiting to be triggered. Try that out and see if it stops the lag.
I have duplicated the emitter and moved it to the back of the background plane of the game and it blows stars once when the level starts. No lagging anymore :)
thanks
No problem, be sure to thumbs up my answer if its helpful :)
Answer by Graham-Dunnett · May 17, 2013 at 02:33 PM
I've tried, that line of code and it does reduce the freezing time, but the game still freeze, when the particles blow... It's maybe from the particles themself, not only from the texture and matterial..