How to Access particleSystemRenderer

I want to change material properties of my particle. How can i access the material property? In the docs there is :



but that doesnt work, it changes the gameObject’s renderer material, not the particles. And no, I cant change it with the color varialbe of the particleSystem, due to many other varialbes in the material that I want to access.

But i cannot access that. It says inherit from renderer, but cant go that way, unity gives me an error.

Is there a way? If this not accessible then why add it to the docs?

The other answer has long been depreciated.

the ParticleSystemRenderer is simply an invisible component attached to the gameobject.

Just use gameObject.GetComponent<ParticleSystemRenderer>() (where gameObject has a particleSystem component).

This is an old question but I was looking for the same answer and I finally figured it out. This worked for me, I hope it still helps or helps someone else!

ParticleSystemRenderer pr = (ParticleSystemRenderer)someGameObject.particleSystem.renderer;
pr.renderMode = ParticleSystemRenderMode.VerticalBillboard;
pr.material.Color = Color.Blue;

ParticelSystem have no renderer parameter anymore.