How to make one animation play instead of another.

Hi there, I was wondering how i could solve this issue:
When i press WASD (move keys) my character runs like he is supposed to.
When i left click, he plays he shoot animation like he is supposed to.

The issue:
When i am running, i want to be able to fire as well, but when i hold down W, then press Left Click, he stops running and plays his fire animation.

The question:
How can i make it so that when i am holding WASD and holding left click , he doesnt play his shoot animation? (Note, the running animation looks like he is shooting so thats why i want only that to play)

Thanks for your help!

You want to use mixing transforms. You can define specific parts of your character’s body and make the animation only affect those parts by choosing the correct parent bone.

Oh. My misunderstanding. In that case, it’s much simpler… just an if statement:


if (how you're detecting your mouse click) {
 if (Input.GetButton("Horizontal") || Input.GetButton("Vertical")) {
  running script;
 } else {
  shooting script;

This could be more detailed, but does it at least give you a place to start?

you could use layers animation layers