Random colors for particles? (10791)

Hello. I know how you can change the color of particles from a script, how can I make it so that every time the effect is instantiated, the colors are different? Thanks.

1 Answer

1

Sadly due to snow and a lack of a pc nearby, I can't test the following. You could store the particle number in script and then when more particles exist try something like:


particle.color = new Color32(Random.Range(0, 255), Random.Range(0, 255), Random.Range(0, 255), 255);

See http://unity3d.com/support/documentation/ScriptReference/Particle.html for more info. See http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter-particles.html to learn how to get and set particles from the emitter.

I hope this helps :)

Colors are not 0-255 unless you use the Color32 class.

–

I've fixed the answer ;)

–