Different Material Settings at Runtime?

I’m making a little smoke mesh appear during run time that slowly fades out by changing the alpha channel of the material. The problem is that if multiple smoke effects occur at the same time then they all have the exact same amount of fading because they all share the same material. Is there any way to avoid this?

There is indeed.

You obtain a script reference to the smoke’s rendering material instance and modify that. The below code when added to a script on your smoke prefab would accomplish this. If you store a reference to the individual smoke object you would use that instead of transform.GetComponent but otherwise it’s the same procedure as you’re likely using to modify the alpha.

var smoke : Renderer = transform.GetComponent (“Renderer”) as Renderer;
smoke .materials.SetColor(“_Color”,alphaAdjustedColor);

Thanks this worked perfectly!