1 Reply
      Latest reply on Aug 11, 2016 1:54 PM by tommybs
      KlemensStrasser Level 2 Level 2 (35 points)

        Hey,


        I hope you can help me out with the following:
        In my GameScene, I have all my game elements in front, and an particle emitter in the background, which constantly emitts particles. Everything works fine during the gameplay, but as soon as the game enters background, things are getting weird. If it stays there for a few seconds and then gets reopend, all particles get removed and 20 new Particles spawn at the same time on arbitrary locations (20 is my Birthrate). And that looks horrible.

         

        I don't know why this happens, because on another screen (where I use the same particle emitter) everything works fine. If the app enters background while beeing on that screen, the particles seem to freeze at their position and continue disolving like they should.

         

        Here is the code I'm using at both screens to add the emitter to my scene:

         

          func addParticleEmitter() {
        
            var path = NSBundle.mainBundle().pathForResource("BackgroundParticle", ofType: "sks")
            var particle = NSKeyedUnarchiver.unarchiveObjectWithFile(path!) as! SKEmitterNode
        
            particle.position = CGPointMake(self.scene.size.width / 2, self.scene.size.height)
            particle.name = "BackgroundParticle"
            particle.targetNode = self.scene
        
            self.scene.addChild(particle)
          }
        
        


        I tried to pause the emitter when enter background and resume it on its comeback, but that doesn't change anything.

         

        Maybe someone of you knows a solution to that.

         

        Thanks and all the best,
        Klemens