ParticleSystem not rendering after changing startColor

I have a prefab with a particle system. Now, in different instances of this prefab I want to change the color of the particles. But, when changing the startColor of the particle system using

gameObject.GetComponentInChildren<ParticleSystem>().startColor = secondaryColor;

the particles just stop being rendered. If I don’t change the color of the particles this way, and keep them on the default startColor of the particle system, it does render properly. Now, I am sure they are being added since triangle and vertex count increases with the amount of particles emitted.

Is there something obvious I am missing to change the color of the particle system? I have absolutely no idea what is causing this to happen.

Check the alpha on your new color. Particle systems do not like having a low alpha, they just don’t render. I just came across this problem too, but manually setting the alpha fixed it.