0

I'm having issues with my node count rising continuously as the SKEmitterNode is going. I have the particleLifetime and the numParticlesToEmit set low. However, it doesn't seem that they're being removed. I've attached a few images to that shows the node count of the scene as the particles start.

node count 14

node count 32

node count 50

nodes: 74

I watched a tutorial of someone using the fire emitter and it showed that the node count was receding after the particles lifetime were up. Another confirmation that they aren't removing from the scene is that my memory is rising and not flattening out. If anyone could help me out or give me some guidance I would greatly appreciate it :) Thanks so much!

func releaseParticles(location: CGPoint) {
    //  SKEmitterNode(s)
    particleEmitterBlastUp      = SKEmitterNode(fileNamed: "ParticleBlast")
    particleEmitterBlastLeft    = SKEmitterNode(fileNamed: "ParticleBlast")
    particleEmitterBlastRight   = SKEmitterNode(fileNamed: "ParticleBlast")

    //If: the SkEmitters are valid
    if let particlesUp    = particleEmitterBlastUp,
       let particlesLeft  = particleEmitterBlastLeft,
       let particlesRight = particleEmitterBlastRight {

        //Setup SKEmitters
        particlesLeft.numParticlesToEmit = 2
        particlesLeft.particleLifetime = 2
        particlesLeft.xScale = 0.23
        particlesLeft.yScale = 0.23
        particlesLeft.zPosition = -1.99
        particlesLeft.position.x = location.x
        particlesLeft.position.y = location.y + (20)
        particlesLeft.xAcceleration = -300
        //Add to: the scene
        self.addChild(particlesLeft)

        particlesRight.numParticlesToEmit = 2
        particlesRight.particleLifetime = 2
        particlesRight.xScale = 0.23
        particlesRight.yScale = 0.23
        particlesRight.zPosition = -1.99
        particlesRight.position.x = location.x
        particlesRight.position.y = location.y + (20)
        particlesRight.xAcceleration = 300
        //Add to: the scene
        self.addChild(particlesRight)
    }
}
Alan Guilfoyle
  • 381
  • 4
  • 13
  • are you sure this is the reason for your frame rate dropping? if you remove the emitters is your frame rate high? – hamobi May 22 '16 at 05:27
  • If you read the docs you will see that you should remove emitter node after emitting is finished. This is because the emitter is still in the node tree and eat up resources in some percent. There is no some kind of emitting completion handler so you have to calculate by yourself when to remove the emitter. – Whirlwind May 22 '16 at 09:17
  • @hamobi yea when I remove them / don't add them to the scene, the node count remains the same. – Alan Guilfoyle May 22 '16 at 18:39

0 Answers0