I've used Animator to create two animation states, I want to change the speed of these animations at run type. How can I get these animations at run time and change their speed? Do I have to attach Animation component or Animator is enough?
Use GetCurrentAnimatorStateInfo() to get current state info.
"Base Layer" is your base layer's name
var currentState : AnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (currentState.nameHash == Animator.StringToHash("Base Layer.Player_standing"))
{
Debug.Log("I'm standing");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With