I have a very little experience in Unity and I'm working with a Unity model provided of 4 animations
I wanted to switch among them with the following state machine
I followed different tutorials like this excellent one from which I took the general organization of the script and where the lack of a condition or exit time doesn't look like an issue [evident from minutes 5:45-6:20]
When I finish my Attack animation I would like to have the idle state back again as in the linked tutorial but in this Unity version [5.5.0f3] looks like "Transition needs at least one condition or an exit time to be valid, otherwise it will be ignored" and the animation gets stuck before exiting Attack. This is evident from the screenshot and as you can see there are no conditions to make the Attack->idle transition
I don't want to overcomplicate the code for such a stupid thing and I would like to avoid to hardcode animations length. Moreover I would like to use Mechanim to handle this thing instead of the script
---> Is there a way to achieve the same effect shown on YouTube in Unity 5.5.0f3?
Thanks in advance to those who will try to help
Answer by Baste
May 12 at 03:33 PM
Transitions needs to have some kind of condition to actually trigger. If you want to automatically transition back to idle from attack after playing the animation, the correct way to do that is to use the exit time. "Has exit time" is horribly named, it really means "will exit automatically after this amount of time has passed".
Your tutorial works in 5:45 through 6:20 as Unity automatically turns "Has Exit Time" on as you create new transitions.
Thanks @Baste, you are right!
I checked again the tutorial and I can see later onin the video the "has exit time" automatically flagged
Thanks again for your help and have a good day, Antonino
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
4 People are following this question.
I can preview the animation but in scene it doesn't work
Why isn't my gun showing up when I play in maximised mode? (Mechanim Animator)
Invalid Layer Index on mecanim animator
"GravityWeight" curve in animator is not affecting the rigidbody's gravity?
What hooks exist for modifying and drawing in the animator window?