How do I animate in only one axis?

I’m trying to animate on one axis (only the x value) and leave the others the same as to what it was. I already tried deleting the keyframe that animate the axis I don’t wanna animate but it didn’t work. I don’t wanna ‘lock’ the y and z axis cuz I’m gonna change them by script. Is there a way to get around this problem?

The solution I’ve used in this case is to create an Empty Game Object as a parent, drop your object as a child under this parent. Now your script changes the Y & Z of the parent but you animate the X of the child.