I have tried Input.GetButton(“Fire1”) as well and it still does not work if other buttons are pressed or held at the same time. I am trying to do trigger a shooting animation when i run but i can only get it to work while standing. it does not work even if i hold down an unrelated button that i don’t use for anything. here’s my code if it helps! And the Debug.Log messages only appears in the console if i am standing still and no other buttons are pressed or held while pressing or holding Mouse0. Oh and i want to be able to click anywhere on the screen not just on specific object! sorry for wall of text and thanks in advance!
public Animator MyAnimator;
void Start () {
MyAnimator = GameObject.Find("GunShotAnim").GetComponent<Animator> ();
}
void Update () {
if (Input.GetKey(KeyCode.Mouse0)) {
MyAnimator.SetBool ("BOOM", true);
Debug.Log ("ClickDown or held");
} else if (Input.GetKeyUp(KeyCode.Mouse0)) {
MyAnimator.SetBool ("BOOM", false);
Debug.Log ("clickUp");
}
}