Skip to main content
Tweeted twitter.com/StackGameDev/status/954797881445306378
deleted 8 characters in body; edited tags; edited title
Source Link

Unity: how intercept Mouse Click on UI and not fire "shoot"  ?

I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0)) 
      Fire();
}

What i want to do is that if I click on a UI button , the "Fire"Fire() routine not will be called.

How to do to say Unity "if InputGetMouseButtonDown(0) && !UI clicked"if InputGetMouseButtonDown(0) && !UI clicked ?

Thanks

Unity: how intercept Mouse Click on UI and not fire "shoot"  ?

I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0)) 
      Fire();
}

What i want to do is that if I click on a UI button , the "Fire" routine not will be called.

How to do to say Unity "if InputGetMouseButtonDown(0) && !UI clicked" ?

Thanks

Unity: how intercept Mouse Click on UI and not fire "shoot"?

I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0)) 
      Fire();
}

What i want to do is that if I click on a UI button , the Fire() routine not will be called.

How to do to say Unity if InputGetMouseButtonDown(0) && !UI clicked ?

Source Link
stighy
  • 467
  • 6
  • 32
  • 60

Unity: how intercept Mouse Click on UI and not fire "shoot" ?

I've a classic

void Update() {
   if(Input.GetMouseButtonDown (0)) 
      Fire();
}

What i want to do is that if I click on a UI button , the "Fire" routine not will be called.

How to do to say Unity "if InputGetMouseButtonDown(0) && !UI clicked" ?

Thanks