Touch Ended Position

Hi guys,

How do I get the end position where the user lift of from screen? Like input.getmousebuttonup(0) or (1) but left or right side of screen.I can find which side the user taps the screen but not where it ended.

Thanks

You can do it using TouchPhase.Ended and Touch.Position.

Something like this:

Vector2 touchPosition;

if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
{
    touchPosition = Input.GetTouch(0).position;
}

You can even do it for multiple touches by providing the index of touch instead of 0 to the Input.GetTouch.