In the example it shows changing the startlifetime like such:
void Update() {
var main = ps.main;
main.startLifetime = hSliderValue;
}
how does this work? MainModule type is a struct not class, assigning a new lifetime value to a copy of the mainmodule value should mean nothing to the value stored in ps.main.startLifeTime?
the ps.startLifeTime property has since become deprecated and so need to modify the values via the main property, just can’t see how the above would work??!!
u cant change the constantMin or max directly , u have to deal with it like a transform.position, change it with a vector3. but not a vector it uses a MinMaxCurve()
like this:
ps.main.startSize = new ParticleSystem.MinMaxCurve(minFloat, maxFloat);
I keep seeing this mention of ps.main.startSize and I was unable to implement it as stated above so I wanted to add clarity for everyone that might run into this issue. Here is the error I would get:
ps.main.startSize cannot modify the return value of particesystem.main because it is not a variable```
And here is the code needed to adjust particle start size through script:
```csharp
//you can assign the particle system through the inspector
public ParticleSystem ps;
//access the particle module, in this case MainModule
private ParticleSystem.MainModule pMain;
void Start(){
//get the main module from the particle system
pMain = ps.main;
}
void Update(){
//set the start size of the particles
pMain.startSize = new ParticleSystem.MinMaxCurve(10f, 12f);
}
Hope this helps for anyone else running into this issue.