I have an app where the user can edit an emitter node and take a screenshot to the photo library. In the settings where they can change stuff like the birthrate, angle, ect. I allow them to change the color of the emitter node.
I am using:
node.particleColor = [SKColor redColor];
and it isn't changing the color of the particles.
However when I added NSLog
statements to it and asked it what node.particleColor
was it returned 1 0 0 1
, which is what I was expecting but the node never changes color.
Any ideas as to what I can do to change its color?
Hey i think i just figured out this problem. Not sure if your code is different however.
For me i have a SKEmitterNode created like this
SKEmitterNode *explosion = [NSKeyedUnarchiver
unarchiveObjectWithFile:[[NSBundle mainBundle]
pathForResource:@"Explosion" ofType:@"sks"]];
then to change its color i do this
explosion.particleColor = [SKColor redColor];
then in i set the blend factor to 1
explosion.particleColorBlendFactor = 1.0;
and finally i turn the color sequence to nil (this was the tricky part)
explosion.particleColorSequence = nil;
By turning the color sequence to nil, it no longer ignores the particle color. Not sure why it initially wasn't set to nil like the reference says, but this is what fixed it for me. Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With