Editor Script Multiple Curves?

I’m trying to make a custom curve editor for an asset. I can use CurveField, which uses AnimationCurve and has a nice Editor window. However, it seems to be stricted to single curve. Is there a solution for multiple curves, like in bottom image?



Hello @ahillel !! Have you found a solution for the multiple curves editor?
I have seen that a feedback topic on it is running https://feedback.unity3d.com/suggestions/multiple-curves-in-curve-editor-window (i gave all my votes for it :wink: )
Hope a trick exists :slight_smile:

###Seems not###

Some old conversations in the forums revealed nothing. The question has been asked again recently with no success. Well, maybe some ideas have emerged.

Hopefully eventually###

Multiple curves at once has been requested in the feedback sections. All indicating to me that, for now, Unity doesn’t have a super easy way. Yet. At least not as easy as the single AnimationCurve class.

Why don’t you just try to use “Runtime Curve Editor”? With that, it is possible to edit more animation curves at once, in-game, in play-mode.

Leave it to me to necro a 7 year old post.

I did a little digging this morning. In the published UnityCsReference, UnityCsReference/Modules/ParticleSystemEditor/ParticleSystemModules/ModuleUIHelpers.cs has some interesting bits.

Such as, GUITripleMinMaxCurve, which appears to be the actual inspector field drawer. Between that function and SerializedMinMaxCurve.cs, that might be enough to get close enough for you to do your own field that behaves like the particle system’s do. (What with drawing the 3 little ‘micro’ curves that can be toggled.)

The real interesting bit is from like your screenshot there, what they draw in the preview gui, which is mostly the contents of ParticleSystemCurveEditor.cs. You can see a bit of how they use that class in ParticleEffectUI.cs.

Downside to all of this, is all of that code is pretty dependant on other bits of internal classes, so cutting out the bits you want isn’t so easy. Upside is that, it looks like everything is there, so with enough time and effort you could reproduce most of it!