How to use AnimationUtility.SetEditorCurve?

Hello. I want to add curve in one button, so iwant to use AnimationUtility.SetEditorCurve,but some point icant understand.

in example, if iwant to add curve of selected object’s position.x to AnimationClip named ‘example’,

AnimationUtility.SetEditorCurve(

AnimationClip, —AnimationClip want to addcurve, in this time ‘example’.

string, —I think Object’s hierarchy add to curve.

Type, — in this time ,“typeof(Transform)”?

string, — What is this?

AnimationCurve —I think i make curvedata curve = new AnimationCurve(Keyframe(transform.position.x, 0), Keyframe(transform.position.x, 1)

)

i cant understand overall, especialy fourth string is mysterious.
Anyone know this? Thanks.

arg1 AnimationClip
arg2 RelativePath
arg3 Type(typeof(GameObject), typeof(Transform)
arg4 Is private prop…

about arg4 name,you can reference AnimationUtility.GetAllCurves to get prop names.

There are some common properties of Transform:

m_LocalPosition.x
m_LocalPosition.y
m_LocalPosition.z

m_LocalScale.x
m_LocalScale.y
m_LocalScale.z

m_LocalRotation.x
m_LocalRotation.y
m_LocalRotation.z
m_LocalRotation.w