The best overloaded method match for `UnityEngine.Camera.ScreenPointToRay(UnityEngine.Vector3)' has some invalid arguments

Hi, I’m new to programming in Unity. I’m trying to make a game where you can control boats with touch controls (for android tablet).

I get two errors on line 21:
The best overloaded method match for `UnityEngine.Camera.ScreenPointToRay(UnityEngine.Vector3)’ has some invalid arguments

and

Argument #1' cannot convert UnityEngine.Touch’ expression to type `UnityEngine.Vector3’

Here is my code:

public class Touch : MonoBehaviour {

	Ray ray;
	RaycastHit hit;

	public Transform target;

	public LayerMask currentMask;
	

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

			var touch = Input.GetTouch(0);

			ray = Camera.main.ScreenPointToRay (Input.GetTouch(0));

			if (Physics.Raycast (ray, out hit, 1000, currentMask)){

				if (Input.touchCount > 0)
				
				// Handle finger movements based on touch phase.
				switch (touch.phase) {

					case TouchPhase.Began:
						target.position = hit.transform.position;
						Debug.Log ("hit ground");
						break;
						

					case TouchPhase.Moved:
						target = hit.transform;
						target.position = hit.transform.position;
						Debug.Log ("hit boat");
						break;
						

					case TouchPhase.Ended:

						break;
					
				}
			}
		}
	}

Thanks in advance!

ScreenPointToRay(UnityEngine.Vector3)’ has some invalid arguments

Just like the error says… You are passing a Touch object to the method that wants a Vector3

ray = Camera.main.ScreenPointToRay (Input.GetTouch(0));

should be

ray = Camera.main.ScreenPointToRay (Input.GetTouch(0).position);