0
\$\begingroup\$

I have a unity animator setup like so. When the game runs, I can trigger each state in the state machine with user input. I can use HasExitTime flag to trigger the animation, and it will play through and loop infinitely as expected.

However, when I try to use the GearChange trigger, the state machine progress bar plays, the correct box is triggered, but the animation itself doesn't play! I'm at a total loss as to what the problem is here, as everything else is exactly the same, minus the user input.

The console isn't showing any errors, the animation simply doesn't respond to the state machine. What am I missing here?

Unity version 2020.1.0f1

So I deleted the animator, and setup everything again the exact same way. Now the animation won't play, period. The state machine progress bars are still triggered as expected, but the animation won't play.

In the transition preview, the animation won't play there either.

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ if I may know, what is the behavior you wanna achieve with that. Why don't you use boolean trigger, then in the user input, for ex : if the key "A" up the trigger become true, then if the key down, the trigger become false? \$\endgroup\$ Aug 5, 2020 at 11:44
  • \$\begingroup\$ I did try that. It had the same behavior as the trigger. Turns out the problem was I hadn't assigned an avatar to the animator. \$\endgroup\$ Aug 5, 2020 at 21:35

1 Answer 1

0
\$\begingroup\$

The problem here turned out to be the lack of assignment of an avatar to the animator. Without an avatar assigned, the behavior of the animator component was all over the place. Sometimes working, sometimes not working for the exact same settings.

When I assigned the animator an avatar (you can use the unity tools to do so via: Find your animation file -> Select 'Rig' -> Under Avatar Definition Select 'Create From Model'

Unity will then create an avatar for your animation. When add the animator to your game object, you can assign an avatar to the component. Pick the one unity generated.

My best guess is that this unexpected configuration caused a bug in Unity. IMHO, they'd be better off to throw an error for you, but it's immaterial now.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .