UnityEditor.AnimationClipInfoProperties.AddCurve C# (CSharp) Method

AddCurve() public method

public AddCurve ( ) : void
return void
        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;
            }
        }