Modifying particle renderer material and assigning new particle emmitter

Hi guys

I was wondering how you would be able to access the partical render material, so that i can modify them at runtime? Ive gone over the script reference but i cant seem to find a method or variable that specifically returns the materials of the particle renderer for that object.

Also i was wondering if i could overwrite a particle emitter within the object with another particle emitter. I have tried this:

object.particleEmitter1 = particleEmitter2;

However the compilor doesnt allow this to work. I recieve an error saying read only.

I dont really want to destroy the original component , then attatch the new emmiter since it sounds risky.

Thanks in advance

If you just want to change the material, this works:

var newMat : Material;

function Start()
{
	gameObject.GetComponent(ParticleRenderer).renderer.material = newMat;
}

As for assigning a new particle emitter, I would either change the particle emitter properties in runtime, or have another particle emitter already set up and turn it (and turn off the original particle emitter).

Hope this helps. Tell me if it doesn’t work.