public void AddCurve()
{
SerializedProperty property = this.Get("curves");
if ((property != null) && property.isArray)
{
property.InsertArrayElementAtIndex(property.arraySize);
property.GetArrayElementAtIndex(property.arraySize - 1).FindPropertyRelative("name").stringValue = "Curve";
Keyframe[] keys = new Keyframe[] { new Keyframe(0f, 0f), new Keyframe(1f, 0f) };
AnimationCurve curve = new AnimationCurve(keys) {
preWrapMode = WrapMode.Default,
postWrapMode = WrapMode.Default
};
property.GetArrayElementAtIndex(property.arraySize - 1).FindPropertyRelative("curve").animationCurveValue = curve;
}
}