Touches only valid for one update?

If I store a Touch in one update, am I not supposed to get the updated data from it the next update?

Doing something like this:

var myTouch:Touch;

function Update()
{
  if(Input.GetTouch(0).phase == TouchPhase.Began)
    myTouch = Input.GetTouch(0);

  Debug.Log(myTouch.position);
}

I expected the log to be updated with the Touch's position if I dragged around my finger. But instead I only get the initial touch position.

Is there a way to store something like this so I don't need to loop through fingerIds every time?

The problem is simply that your if-statement is only checking for TouchPhase.Began. This will only be true the first frame. After that, your variable myTouch is not getting updated.

TouchPhase.Moved what u need.. it sends new position if u hold and drag on screen.With begin u only get the initial position when u out your finger then for dragging u have to use TouchPhase.Moved also u can get the last position that u finished swiping with TouchPhase.Ended

Touch is a struct which is a value type. This means that it copies the values instead of having a reference or “link” to the Touch. So on frame one if you save the Touch to a variable it copies the values at that time and saves them but has no idea what that Touch is up to anytime after that. You have to keep updating it every frame. So save the finger ID of the touch so you can find the input that you want in future frames.

Hope that helps.