I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?
To me its looks like "has exit time" is check. so set your transition from walk to dash like this:
also apply same settings for transition Idle to Dash.
"Has Exit Time": Exit Time is a special transition that doesn’t rely on a parameter. Instead, it relies on the normalized time of the state. Check to make the transition happen at the specific time specified in Exit Time.
For more information read unity manual here.
Its looks like there is no direct transition from walk to dash. So first it complete walk animation then it goes back to idle and then dash. Just my assumption. If i am right then create direct transition from walk to dash whit 0 "exit time" and unchecked "has exit time", So when dash occurs animator will directly jump to the dash with out any delay.
I Hope this will help...