1
\$\begingroup\$

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?

\$\endgroup\$
1
\$\begingroup\$

To me its looks like "has exit time" is check. so set your transition from walk to dash like this:

enter image description here

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.

Reason 2:

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...

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Has Exit Time is not checked. I initially thought the same thing. \$\endgroup\$ – ethan codes Sep 24 '19 at 18:31
  • 1
    \$\begingroup\$ Ok. Then its looks like there is no direct transition from walk to dash. So first it complete walk animation then it goes to idle and then dash. Just my assumption. If i am right then create direct transiton from walk to dash whit 0 exit time and unchech has exit time. So when dash occurs animator will directly jump to the dash with out any delay. I am on mobile right now so might be mistaks. \$\endgroup\$ – Swati Sep 24 '19 at 18:42
  • \$\begingroup\$ Also make sure to set transition duration to 0 and transition offset. \$\endgroup\$ – Swati Sep 24 '19 at 18:45
  • \$\begingroup\$ Correct, the transition time was the problem! Thank you. \$\endgroup\$ – ethan codes Sep 24 '19 at 18:59
  • \$\begingroup\$ I am glad i was help full. i will update my answer if some need it. \$\endgroup\$ – Swati Sep 25 '19 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.