This is the code I used in iOS 8 to get the particle to appear:
func onCollision() {
let explosion = SKEmitterNode(fileNamed: "rocketExplosion")
explosion.position = rocket.position
explosion.zPosition = 100
addChild(explosion)
}
Worked fine for iOS 8 but not for iOS 9. I've read that there were problems with the particle emitters in the beta, are they still the same in GM version? Also, I tried this after a "Swift 2" tutorial but no luck:
if let explosion = SKEmitterNode(fileNamed: "rocketExplosion") {
explosion.position = rocket.position
explosion.zPosition = 100
addChild(explosion) }
Hopefully this will help you
let explosionFile: String = NSBundle.mainBundle().pathForResource("rocketExplosion", ofType: "sks")!
let explosion = NSKeyedUnarchiver.unarchiveObjectWithFile(explosionFile) as! SKEmitterNode
explosion.position = rocket.position
explosion.zPosition = 100
self.addChild(explosion)
I had a similar issue while using objective c (so it's not a swift 2 only issue). I found that the particle effects were being rendered behind my background. I've tried setting them on a different Z layer but they still didn't work.
In my experience with iOS 9 if you have a background image it has to be set to at least -1 for particles to work. It seems to only effect my background image. It's able to render the EmitterNodes correctly above all of my other sprites.