Problem: Animations Priority

Hi there, i’m going crazy with an animations problem.
I’m working on a 2D Fight Game and i’ve these problem. I have 4 animations: jump - walk - attack - idle. I want set the attack animation as more important than walk and jump because i want that my game play attack if i press the attack key while i’m moving right or left.
Do you know an easy way to solve this?
i don’t know if the problem is in my movement script (“Input.GetKey(KeyCode.A)” ) or in my attack script that use a “GetKeyDown” function. I’ve tried with layer but i don’t know them very well.
If someone could help me it would be great

You might be interested in my Animancer plugin (link in my signature) which has lots of detailed examples, including one specifically about determine which actions can interrupt each other and one about implementing a simple platformer character.