touch.position gives (0,0)

update()

{

if(Input.GetTouch(0).phase==TouchPhase.Stationary || Input.GetTouch(0).phase==TouchPhase.Moved)

{

     currentPos=new Vector3(touch.position.x,touch.position.y,0);

 }

}

OnGUI()

{

GUI.Box(new Rect(180,200,150,40),"currentPos : "+currentPos);

}

I am trying to get the touch position for android but this is not giving me that. Instead its giving (0.0,0.0,0.0). Actually i want the angle between two vector 1.center of screen and 2.touch position. Any solution for this???

It looks like you never set the actual position variable using the correct input code. To calculate angle from one position to another you would use Atan2 which will be returned in radians. You most likely want to convert that into degrees. Example:

#pragma strict

static var touchAngle : float;
private var screenCenter : Vector2;

function Start () {
	screenCenter = Vector2(Screen.width/2, Screen.height/2);
}

function Update () {
	if (Input.touchCount>0) CheckInput();
}

function CheckInput () {
	var touchPos : Vector2 = Input.GetTouch(0).position;
 	var diff : Vector2  = screenCenter - touchPos;
    touchAngle = Mathf.Atan2(diff.y, diff.x)*Mathf.Rad2Deg;
    Debug.Log(touchAngle);
}

Keep in mind that the GUI-class currently is quite heavy to run for a phone.