- Home /
Question by
bekiryanik · Jul 22, 2014 at 04:15 AM ·
animationanimationclipanimationcurve
How can i set the animation speed via codes?
Hello everyone,
As you see in the title, i would like to set animation speed via code. I created the animation and the controller in Assets folder and i don't know how to control speed of these animation files.
Comment
Best Answer
Answer by Franky_Cranky_Man · Jul 22, 2014 at 04:45 AM
You need to reference the animator and then you can set the speed:
public float animSpeed;
public Animator anim;
void Start()
{
animSpeed = 1.0f;
anim.speed(animSpeed);
}
void SetAnimatorSpeed(float newSpeed)
{
anim.speed(newSpeed);
}
Your answer
Follow this Question
Related Questions
AnimationCurve for ScriptableObject 0 Answers
What is the proper use of AddClip and SetCurve? weird Quaternion error 0 Answers
Animation won't play? Please help! 7 Answers
key count: 1 on curve 'curvename' error 1 Answer
Scripted animation not working 1 Answer