setting background color hides SKEmitterNode

120 Views Asked by At

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)
    }
1

There are 1 best solutions below

0
ScottS On

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