0

How can I have a white background and use SKEmitterNode in SpriteKit?

The emitter disappears if I set the background color of the SKScene. On the default black background I can see the red particles (when I comment out "backgroundColor = .white" in my SKScene). If I use a CAEmitterLayer then I can see the particles with a white background, but would like to use SKEmitterNode. I've spent a couple hours trying to find any reference to this problem.

Code is very simple -- adds child to SKScene

    if let particles = SKEmitterNode(fileNamed: "Sparks.sks") {
        particles.position = position
        scene.addChild(particles)
    }
  • Sorry, appears it is just something to do with the color white. Other color backgrounds will allow the emitters to show up, I just need to find the right color combinations. – Sam Hawksworth Feb 04 '20 at 16:37
  • Even worse... just had to change blend mode in editor – Sam Hawksworth Feb 04 '20 at 16:43
  • FWIW, if you prefer the look of the emitter particles with add mode, a trick is to leave the blend mode as add in the editor and then wrap the emitter in an `SKEffectNode`. The effect node can then be mixed into the rest of the scene with a different blend mode. – bg2b Feb 04 '20 at 17:38

1 Answers1

0

instead of the default .white, you may want to try setting the color with a color close to white... i.e. a UIColor where the RGB is .9,.9,.9

ScottS
  • 36
  • 1
  • 2