I’m working on a script to get the values of a particle system. I understand Unity doesn’t allow reading MinMaxCurves whose mode is ParticleSystemCurveMode.Curve or TwoCurves, therefore I setup a function to check a given MinMaxCurve’s mode.
The problem I have is even querying that mode property throws the “Reading particle curves from script is unsupported unless they are in constant mode” error, for MinMaxCurve’s whose mode is Curve or TwoCurves.
Is there anyway for me to check a MinMaxCurve’s mode without getting that kind of error?
Unfortunately this isn’t possible in 5.3 using the particle system script API. In 5.4, this whole issue is fixed, and you are able to read curves/gradients regardless of what mode they are in.
For 5.3, it would be possible to read the value using the SerliazedObject API, eg:
For the curves, the mode is in a variable called “minMaxState”, which corresponds to the ParticleSystemCurveMode enum. Eg “InitialModule.startLifetime.minMaxState”. That second link has the best example of this.