How do I change the startcolor.r in code?


I need to have a particle system change slowly from a predetermined color ,in an array, to white. I thought the easiest way to do this might be have the startcolor r, g, b values in update like this.


But it won’t compile. Can anyone help me?

particleSystem.startColor = new Color (1, 1, 1, 1);

how about this? So you can transition form one color to another.

public Color StartColor;
public Color Endcolor;
Color particelcColor;
float progress =0;

void Update() {
     progress += Time.deltaTime * 0.5f; //speed modifier 	
     particelcColor= Color.Lerp(StartColor,Endcolor,progress); //lerp the colors		
     particleSystem.startColor = particelcColor; //assign them