1
\$\begingroup\$

I've a 'classic' humanoid player with an animation controller and some animations.

This is the code i'm managing state changin

 float h = CrossPlatformInputManager.GetAxis ("Horizontal"); if (h < 0) { m_Animator.SetTrigger ("LeftWalking"); } else if (h > 0) { m_Animator.SetTrigger ("RightWalking"); } else if (m_CharacterController.velocity.magnitude != 0) { m_Animator.SetTrigger ("Walking"); } else if (m_Jumping) { m_Animator.SetTrigger ("Jump"); } else { m_Animator.SetTrigger ("Idle"); m_Animator.ResetTrigger ("Walking"); m_Animator.ResetTrigger ("LeftWalking"); m_Animator.ResetTrigger ("RightWalking"); m_Animator.ResetTrigger ("Jump"); } } 

My problem is that after i stop to press my "forward" button (that make my player walking), the walking animation continue to play itself till the end.

This is my state machine enter image description here

This is options of Walking to Idle state

enter image description here

I'm pretty sure I've to "play" with HasExitTime and/or FixedDuration but i'm not sure...

\$\endgroup\$
0

1 Answer 1

3
\$\begingroup\$

Remove the HasExitTime checkbox to allow the transition to trigger at anytime.

See the documentation about HasExitTime

\$\endgroup\$
1
  • \$\begingroup\$ In your opinion is it also correct to manage state using Trigger variable instead Boolean ? \$\endgroup\$ Commented Feb 15, 2018 at 16:05

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.