I want to change the curve property of
particleSystem.main.startLifetime
If I write
particleSystem.main.startLifetime = new ParticleSystem.MinMaxCurve();
it says
Cannot modify the return value of 'ParticleSystem.main' because it is not a variable
If I try this
particleSystem.main.startLifetime.curve = minCurve;
it says
Cannot modify the return value of 'ParticleSystem.MainModule.startLifetime' because it is not a variable
And if I try to change the curve directly
foreach (var key in minCurve.keys)
{
Debug.Log("adding a key");
particleSystem.main.startLifetime.curve.AddKey(key);
Debug.Log("length: " + particleSystem.main.startLifetime.curve.keys.Length);
}
It doesn't change the curve at all. The Length is the same, and in the window the curve doesn't change too.
So what do I do wrong?