How can I use 'curves' like ParticleSystem has?

So I want to be able to have a script where some of the variables are a ‘curve’ like you see in Shuriken particle systems. I need one for color, and one for just a floating point mapping (something like ‘particle size over time’).

How can I get that type of thing?

1 Answer

1

I’m guessing you write your own using this: Unity - Scripting API: EditorGUI.CurveField

But it would be cool to have a ‘curve’ data type. And since you mention it, the docs on ParticleSystem are pretty cryptic: “When using curves, this values acts as a scale on the curve.” But does not say how to ‘use curves’ programatically.

What data type should I use?

That API indicates AnimationCurve. Seems like there should be a generic Curve datatype, right? But you should be able to extract values from that for whatever purpose

Ok that should work for the float value, thanks. Do you know of any color range thing?

I'm guessing Shuriken wrote a custom Editor GUI window to popup the color pickers and then set those RGBA values to AnimationCurves

Yeah that sounds likely.