1 Reply
      Latest reply on Aug 29, 2019 3:27 PM by AHoth
      YAH Level 1 Level 1 (0 points)

        I am curious, does anyone else encounter the problem the problem that the action is simply not run? It does accept the action in the code but later when the particles are created the run action seems to be not called for the particles.

        Has anyone a solution to how to create particles with a working particleAction in SpriteKit?

        Does anybody know if Apple is working on this?

        • Re: particleAction not working?
          AHoth Level 1 Level 1 (0 points)

          I, too, am unable to get .particeAction to work; have tried everything I could find on forums (remove targetAction, change/remove zPosition, remove/re-add emitter to scene, maintain a reference to particleAction outside of emitterNode). Particles show up but with no SKAction applied.

           

          Anyone able to help?

           

          Xcode 10.2.1 on Mojave 10.14.5 building for iOS12.2:

          ----

          class GameScene: SKScene {

           

              private var particleAction: SKAction?

           

              override func didMove(to view: SKView) {

                  let emitter = SKEmitterNode(fileNamed: "TestEmitter")!

                  emitter.position = CGPoint.zero

                  //emitter.zPosition = 9999

                  //emitter.targetNode = scene!

                  self.particleAction = SKAction.scale(to: 0, duration: 3)

                  emitter.particleAction = self.particleAction

                  addChild(emitter)

               

                  for case let emitter as SKEmitterNode in scene!.children {

                      emitter.removeFromParent()

                      let newEmitter = emitter.copy() as! SKEmitterNode

                      scene?.addChild(newEmitter)

                  }

              }

          }

          ----