Question by
unity_D4hJ1MvxFM57Mw · Apr 05, 2018 at 07:45 AM ·
animationanimationclip
Creating AnimationClip Using Custom Values
I would like to create an animation using a custom value from a class I'm animating. The name of my class is CharacterMover and it has a property called moveX. I can add the property through Animation window through Add Property menu but I would like to do it using a script.
I can add properties such as localPosition.x in code but CharacterMove.moveX or others I have tried haven't worked. What is the correct syntax?
Comment
Best Answer
Answer by unity_D4hJ1MvxFM57Mw · Apr 05, 2018 at 08:01 AM
Ok, I found the answer. Was looking from a wrong place. Had to use SetCurve with typeof call and the property name as in code.
clip.SetCurve(pathName, typeof(CharacterMover), moveX, animCurve);
Your answer
![](https://koobas.hobune.stream/wayback/20220612160109im_/https://answers.unity.com/themes/thub/images/avi.jpg)