Custom Inspector - Accessing AnimationCurve

I’m trying to add some functionality to the inspector when using AnimationCurves. I’m having trouble accessing the AnimationCurve itself so I can eventually modify it. I get the error that Unity.Object cannot be converted to AnimationCurve. I don’t get this error if my editor script targets one of my custom scripts, only if I target a unity class.

If I add buttons to this script, it applies them to every public AnimationCurve variable in my project, which is exactly what I want, but since I can’t actually access the animationcurve to make changes to it, its not doing me any good.

[CustomEditor(typeof(AnimationCurve))]
public class ExtendedCurves : Editor
{
    private AnimationCurve thisCurve;

    public void OnEnable()
    {
        thisCurve = (AnimationCurve)target;
    }

}

CustomEditors are usually written for Monobehaviour scripts and won’t work with AnimationCurve type since it inherits only from System.Object (from what I can tell).

I suspect that the thing you’re really looking for is an attribute called CustomPropertyDrawer. If that is the case then make this ExtendedCurves class a typical wrapper inheriting from nothing and write CustomPropertyDrawer for it. ExtendedCurves in this scenario can contain and extend AnimationCurve’s functionality easily without conflicts.