Unity's Animator could be a mess. Here is a cleaner approach using just code.
Priority based Animation Finite State Machine (FSM) for Unity2D.
Mostly useful for 2D spritesheet animation, also called flipbook animation.
Support me - / lerg
Animation FSM on GitHub - https://github.com/Lerg/animation-fsm
00:00 Unity's animation system is a mess
00:44 My approach
01:56 Animation clips setup
02:16 Starting the implementation
04:32 Player movement script
05:10 Integrating FSM
07:08 Testing Jump & Fall states
07:18 Integrating other states
08:21 Testing all the states
08:34 Advantages of this approach
08:46 Fixing the Attack state
09:34 Possible extension
09:54 Performance optimization
10:55 Source code and conclusion
11:30 Outro