Do not play animation when you press a keybutton if right mousebutton is already pressed

Hi everyone

I am busy with my own FPS game and i have a weapon. If you press the key “R”, then the Reload animation plays. So now, i don’t want the animation plays when press the key “R” if i already holding the Rightmouse button down, untill the Rightmouse button is up, then the animation can play again when press the “R” key. So now my question is. How can i do that?

Someone can help me please?

Thanks in advance and i hope everyone can understand my problem.

Donilias "

If(input.key(r)&&!input.mouse(3))
{
Play reload animation.
}
This is close to want u need. I’m new to unity but play with this.

The && means “and”. The ! Means not.
So that if statement reads if the r key is pressed and the right click is NOT pressed then do the following.

Hello,

I don’t know your script, but it’s only a question of boolean. You create to variable :

var Shooting : boolean;  
var Reloading : boolean;

And you play with that.

Nbo

P.S: Maybe is you give us the script we can help you.