title: Touch Controls Unity2D
body: <p>Im trying to use touch controls to move my character on a device such as an iPhone. So far I have had limited success. This code works but only with one of the buttons. I have both a left and right button and the left button worked until I added the right button. Now only the right button works. Any help would be appreciated.</p>
  
  <pre><code>foreach (Touch touch in Input.touches)
      {
  
          if(leftButton.guiTexture.HitTest(touch.position) &amp;&amp; touch.phase != TouchPhase.Ended)
              {
                  move = -1;
                  anim.SetFloat ("Speed", Mathf.Abs (move));
  
              }
          else if(rightButton.guiTexture.HitTest(touch.position) &amp;&amp; touch.phase != TouchPhase.Ended)
              {
                  move = 1;
                  anim.SetFloat ("Speed", Mathf.Abs (move));
              }
          else if((leftButton.guiTexture.HitTest(touch.position) &amp;&amp; touch.phase == TouchPhase.Ended) &amp;&amp; 
                  (rightButton.guiTexture.HitTest(touch.position) &amp;&amp; touch.phase == TouchPhase.Ended))
              {
                  move = 0;
              }
  
      }
  </code></pre>