title: How to make gameplay ignore clicks on UI Button in Unity3D?
body: <p>I have a UI <code>Button</code> (using <code>UnityEngine.UI</code>).</p>
  
  <p>However, clicking on the <code>Button</code> seems to be <strong>clicking through</strong> onto the scene (in my case clicking a nav mesh).</p>
  
  <p>How to solve this problem?</p>
  
  <p>I've been using typical Unity3D code to get user in put in gameplay such as</p>
  
  <pre><code>if (Input.GetMouseButtonDown(0))
    {
  </code></pre>
  
  <p>same if I try the approach</p>
  
  <pre><code>if( Input.touches.Length &gt; 0 )
          {
  
          if ( Input.touches[0].phase == TouchPhase.Began )
              {
  </code></pre>
  
  <p>and it seems to be the case on iOS, Android, and desktop.</p>
  
  <p>It seems to be a basic problem that clicks on the UI (<code>UnityEngine.UI.Button</code> etc) seem to fall through to the gameplay.</p>