Deleting animation curve

I need to delete animation curve with transform.position from my animation clip.
I duplicated animation. I can delete it using animation editor, but i need to delete a lot of animations, so i need a script. I have this one, but it doesn’t work(((

using UnityEngine;
using UnityEditor;
using System;

public class FixAnimation : ScriptableObject
{
    [MenuItem("Custom/FixAnimation")]
    static void ListChildTransforms()
    {
        GameObject go = Selection.activeGameObject;
        string parent_name = go.name;
        AnimationClip anim=go.animation["jumpc"].clip;
        //Hip
        anim.SetCurve("Player/Armature/Master/Ass/Hip", typeof(Transform), "m_localPosition.x", null);
        anim.SetCurve("Player/Armature/Master/Ass/Hip", typeof(Transform), "m_localPosition.y", null);
        anim.SetCurve("Player/Armature/Master/Ass/Hip", typeof(Transform), "m_localPosition.z", null);
     }
}

It can be compiled, but it doesnt delete animation curves.
Help me, please!!! :frowning: [/code]

Up, help me please!

Up

Try to set keys to null.

Thanks, i will try to handle this, using keys.

Setting the curves to null is correct, but there are other problems in your code.

See the answer at UnityAnswers:
http://answers.unity3d.com/questions/11207/deleting-animation-curve-with-editor-script/

Rune

Thanks for reply, but after trying everything you said, I still have a problems, curve is still there.

using UnityEngine; 
using UnityEditor; 
using System; 

public class FixAnimation : ScriptableObject 
{ 
    [MenuItem("Custom/FixAnimation")] 
    static void ListChildTransforms() 
    { 


    GameObject go = Selection.activeGameObject; 

    string parent_name = go.name; 

    AnimationClip anim=go.animation["name of clip"].clip; 

   anim.SetCurve("path", typeof(Transform), "localPosition.x", null); 



 } 

}

And I have Debug message:
"Cleaning up leaked objects in scene since no game object, component or manager is referencing them
AnimationClip has been leaked 6 times.
"
But I dont understand what actually does it mean.

Can’t remove individual position animation curve localPosition.x you must remove the entire animation curve with m_LocalPosition.

Thanks everybody for help. I’ve done with it. It was a bug, after copying project to another folder and reopening, everything begin work well.