I’m trying to make an animation at runtime. I’m using two keyframes for each individual propery. So 6 in total for the x,y and z. But it seems that if i call SetCurve for the x it will write the y and z with zerovalues. So it keeps overwriting when i call it for the y and z.

Is there any other way to set the curve with multiple properties ?

I’m using the following code to set it for each property.

	string animationName = "test";
	AnimationCurve curve = new AnimationCurve(); // already made from keyframes
	string attribute = "m_LocalPosition.x"
	AnimationClip clip = new AnimationClip { legacy = true };

	clip.SetCurve("", typeof(Transform), attribute, curve);

	anim.AddClip(clip, animationName);
	anim.Play(animationName);

I found a answer to my problem.

Just call SetCurve for all properties before calling the AddClip after that it added it as a single curve and now works great!.