Animator.CrossFade interrupts the next animation
Hi guys i have a problem with Animator.CrossFade. Basically i want to change animations with a smooth transition. I initially tried with the booleans, but it started to become a bit messy just with a few animations. Searching online i discovered animator.CrossFade that makes smooth transitions without linking the states in the animator controller. I tried it and i'm having some problems. If i put 0f as transition duration, the animation starts immediately like animator.Play and i don't want this; so i put 0.25f, but in this case the next state is interrupted at the beginning after about a second. This happens only from idle to walk, instead from idle to crouch with 0.25f, the animation plays correctly (very slowly but it ends). I leave a code example:
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (m_playerController.IsMovementPressed)
{
animator.CrossFade("RifleWalk", 0.25f);
}
}
Your answer
Follow this Question
Related Questions
Need help wil wining animation 0 Answers
Play animation on mouse click 1 Answer
Having issues with texturing? 0 Answers