I’ve been trying to figure this out for hours now and i can’t get it right :C
I have the player object which has an animator which has the controller. In this object i have about 3 different animations and i want to change the speed of one of them.
i know i can do something like: animation[“swing”].speed = speed; but that gives me an error saying that there is no animation attached to player object.
i have one reference to the animator: anim = GetComponent();
and if i do anim.speed = speed; that does increase the speed but to every single clip. So how can i change the animation speed of one single clip?
Thanks in advance!
Sorry to necro a thread. But in case others find this thread like me.
Meat’s answer is good. But it also speeds up all the animations on that particular layer.
Unity came up with a solution (finally) after a couple years.
https://forum.unity3d.com/threads/mecanim-change-animation-speed-of-specific-animation-or-layers.160395/page-2
sharing is caring
https://twitter.com/IndieNendoroid
Yes, use
if( animator.GetCurrentAnimatorStateInfo(Layer).IsName("yourAnimation"))
{
animator.speed = animSpeed;
}
Where Layer is the animation layer as int and animSpeed is a float to determine animation speed, where 1 is normal.
This way you can set individual speeds for individual animations.
I’ve never tried it though, I just whipped it up today to answer the same question from about 5 different people 
So, you saw it here first
maybe 