The new Shuriken particle system is pretty nice. One limitation I’ve run into however is that while it allows you to choose the color randomly between two colors or two gradients, I want every particle it spews to choose among 3 random colors from beginning to end, and not from the range between them but discretely one or the other - specifically, solid red, solid green or solid blue.
Would this require a drastic hack to re-write your own particle system, or is there a way to do this as-is?
Here is an approach completely without coding. First set the start color to gradient or random between to gradients.
Than you define your gradient with the colors you want to instantiate.You can set hard gradient boundaries, to have a hard cut between colors.
The colors are iterated one after another. If you want to have a fast iteration set the duration to 1.00.
I’ve never tried shuriken. But maybe you could get the particle array (particleEmitter.particles) and change manually the color for each of them ? How to choose the color randomly isn’t the issue I suppose (just in case, Random.Range(0, 2) and a Color). It’s getting more complicated if the emitter isn’t a one shot though.
Then run through the array setting the ParticleSystem.Particle color member to your random discrete color and finally push the particle array again with SetParticles (Unity - Scripting API: ParticleSystem.SetParticles).