I have a feeling this has a simple answer, but I'm unable to solve it.
I'd like to have custom key/input trigger a mecanim animation (e.g. the space bar press triggers a "punch" animation). Here's what I did:
1. Defined a new input in Unity's input manager as "Punch" with "space" as positive
2. Added a Boolean parameter "Punch" in Unity's animator
3. Added a transition from any state to with Punch condition true to the animation
Hit play. Hit space. Only the Idle's blendtree is playing.
Any idea what I'm doing wrong? Thank you.
Comments
For a true fighting system, you'd probably want to write a dedicated script to handle this, but you can create a simple such link by using Active Inputs (see section 2.14 of the Manual) - you can use one to map the Punch input to trigger an ActionList that contains a "Character: Animate" Action to affect your player's Punch boolean value. A very similar example involving a crouch button is covered in the 2.5D tutorial.