title: Unity multitouch, How to use touch.fingerid
body: <p>I'm trying to build a simple pong game for touch devices (Android and IOS), and this is my first project, I'm really beginner into this thing and I need help, please. </p>
  
  <p>there will be three buttons on the screen. The first button is to move the player paddle up, the second button is to move the paddle down and the third button is to boost the ball speed for 2 seconds when the ball touches the player paddle and in the same time the boost button been touched. </p>
  
  <p>this is my script for the player paddle</p>
  
  <pre><code>public class player1 : MonoBehaviour {
  
      float playspeed = 15f;
      float player1pos;
  
      Ray2D ray;
      RaycastHit2D hit;
  
      Rigidbody2D rb;
  
      Vector2 paddlepos;
  
      GameObject paddle1;
  
          void Update () 
          { 
  
          rb = gameObject.GetComponent &lt;Rigidbody2D&gt; ();
  
          paddlepos = transform.position;
          paddlepos.y = Mathf.Clamp ( transform.position.y , -9f , 9f );
          transform.position = paddlepos;
  
          if (Input.touchCount &gt; 0 )
          {
              for ( int i = 0; i &lt; Input.touchCount; i++)
              {  
                  if ( Input.GetTouch(i).phase == TouchPhase.Began )
                  {
  
                      Vector2 point = Camera.main.ScreenToWorldPoint (Input.GetTouch(i).position);
                      hit = Physics2D.Raycast (point , Vector2.zero, 10);
  
  
                      if ( hit.collider != null )
                      {
  
                      if (hit.collider.name == "up" )
  
                      {
                              rb.velocity = new Vector2 ( 0 , playspeed );                                
                      }
  
                      if (hit.collider.name == "down" )
  
                      {
                      rb.velocity = new Vector2 ( 0 , -playspeed);     
                      }       
                  }       
  
                  if ( Input.GetTouch(i).phase == TouchPhase.Ended )
                  {
                      rb.velocity = new Vector2 (0 , 0);  
                  }           
      }
     }
    }
   }  
  }
  </code></pre>
  
  <p>And for the ball boost button I'm using the following code</p>
  
  <pre><code>public class ball : MonoBehaviour {
  
      public float ballspeed = 7f;
  
      Ray2D ray;
      RaycastHit2D hit;
  
     float previousspeed;
  
  IEnumerator ballbooster()
      {   
          previousspeed = ballspeed;
  
          ballspeed = ballspeed * 1.8f ;
  
          yield return new WaitForSeconds (2);
  
          ballspeed = previousspeed;
  
          yield break;
      } 
  
  void Update ()
  
      {
          if (Input.touchCount &gt; 0 )
          {
              for ( int i = 0; i &lt; Input.touchCount; i++)
              {  
                  if ( Input.GetTouch(i).phase == TouchPhase.Began )
                  {
  
                      Vector2 point = Camera.main.ScreenToWorldPoint (Input.GetTouch(i).position);
                      hit = Physics2D.Raycast (point , Vector2.zero, 10);
  
                      if ( hit.collider != null )
                      {
                          if (hit.collider.name == "boost" &amp;&amp; distance &lt; 5)
                          {
                              StartCoroutine (ballbooster());
                          }   
                      }
  
       }
      }
     }
    }
   }
  }
  </code></pre>
  
  <p>My problem is that I can't use multitouch, for example when I touch the up button and then press the boost button the paddle stop moving. Now I'm trying to handle multitouch. I know that I have to use touch.fingerid to do what I want, but I don't know how to do that in code. Can you please give me an example. </p>