title: Unity: How to stop using "Input.GetMouseButton(0)" when pressing on UI Button?
body: <p>The player is a magican who can attack enemys with fireballs when pressing the left mouse button. </p>
  
  <p>The code i use is pretty simple (inside the <code>Update</code> function):</p>
  
  <pre><code>if (Input.GetMouseButton(0) &amp;&amp; canShoot)
  {
      canShoot = false;
      Invoke("AllowCanShoot", fireBreak);
      Attack();
  }
  </code></pre>
  
  <p><code>canShoot</code> is a <code>bool</code> which stops the player from attacking once per frame.</p>
  
  <p><code>AllowCanShoot</code> is a function that sets <code>canShoot</code> to <code>true</code>.</p>
  
  <p><code>Attack()</code> is the function that handles the attack, not relevant for this question. </p>
  
  <p>I also have a UI Button that appears on screen when the player is near the trader. When the player presses the UI Button he attacks the trader. </p>
  
  <p>What i want is, that he could press the button without attacking him. </p>
  
  <p>I can't disable attacking for the player, because enemys can get to the trader, too, and the player may have to fight then. </p>
  
  <p>What i tried is:</p>
  
  <ul>
  <li>setting the <code>canShoot</code> <code>bool</code> to <code>false</code>, when the <code>UI Button</code> is pressed, but this isn't working, the player is still attacking, maybe the <code>Update</code> function gets executed before the <code>UI Button</code> function?!</li>
  </ul>