title: How to detect click/touch events on UI and GameObjects
body: <p>How to detect UI object on Canvas on Touch in android?</p>
  
  <p>For example, I have a canvas that have 5 objects such as <code>Image</code>, <code>RawImage</code>, <code>Buttons</code>, <code>InputField</code> and so on.</p>
  
  <p>When I touch on Button UI object Then do something. Each button do different process when clicked depending.</p>
  
  <p>The code will look like:</p>
  
  <pre><code>private void Update()
  {
      if (Input.touches.Length &lt;= 0) return;
  
      for (int i = 0; i &lt; Input.touchCount; i++)
      {
          if (Button1.touch)
              if (Input.GetTouch(i).phase == TouchPhase.Began)
                  login();
          else if (Button2.touch &amp;&amp; Input.GetTouch(i).phase == TouchPhase.Began)
              LogOut();
      }
  }
  </code></pre>
  
  <p>So how to do it?</p>
  
  <p>Second:
  How to detect Gameobject get touch? Is it same with that above or not?</p>