I’m having trouble getting SetCurve to work on animation clips for me. Here’s the code I’ve got written:
AnimationCurve xCurve = new AnimationCurve();
xCurve.keys = new Keyframe[2] { new Keyframe (0, flickOriginTransform.position.x) , new Keyframe( 0.2f, flickVector.x * flickVelocity) };
flickClip.SetCurve("", typeof(Transform), "Position.x", xCurve);
animObj.AddClip(flickClip, animName);
animObj.Play(animName);
When I run the scene, there’s never any curve placed into the Animation tab on the GUI and a button pops up “Clean Up Leftover Curves”. When I press it, I get told “the following curves in the animation clip are for properties that do not exist” with Position.x listed. (I’ve also tried _Position.x, _position.x position.x just to make sure I’m getting the property name right, to no avail).
Am I missing something? I’ve looked through the documentation and cannot find the strings names for the Transform property’s curves. I’ve tried the AnimationAPI download however it only changes a curve on Materials and seems to be what I am already doing.
Got any ideas?
Thanks.