Get touch position?

All I need is to get the x coordinate of the touch position.

I want to know if the user has tapped on the right half of the screen.

This may not be the only touch on the screen… so here is what I have so far:

#pragma strict

function Update (){            
    for (var i = 0; i < Input.touchCount; ++i){
    	if (Input.GetTouch(i).phase == TouchPhase.Began) {
	  		if (Input.GetTouch*.position > parseFloat(Screen.width/2)){*

//do something

  •  		}*
    
  •  }*
    

}
}
Can someone help me?

One error in you code is using "GetTouch*" on line 6, when it should be “GetTouch(i)” as demonstrated on the line before it.*
Usually if you are repeatedly calling the same getter it is neater and easier to store that value of interest locally.
function Update () {
for (var i = 0; i < Input.touchCount; ++i) {
Touch touch = Input.GetTouch(i);
if (touch.phase == TouchPhase.Began) {
if (touch.position > (Screen.width/2)) {
//do something
}
}
}
}