Scripting animation controllers

I have all my Animations set up (Picture) they all work ive tested them in the game view and everything. I just don’t know how I would properly Script these animations to play with certain key presses like if the weapon is in hand play this swing and animation and if the weapon is not in hand play this swing animation.

Thank you in advance for all help :slight_smile:

[31510-unity+2014-08-25+10-21-55-325.png|31510]

You set the connections between animation states, and in the connection you define when it will activate (what properties have to be for it to activate). Then from the script, you use the animator.SetBool(or SetFloat, SetTrigger, etc) to set the properties, and the state machine will automatically switch states when necessary.

If you’re still unsure, view the unity animation tutorials; See unity animation tutorials: Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn.

Namely watch tutorials #2, %5 and #9.