Check out example codes for "unity mobile touch input". It will help you in understanding the concepts better.

Code Example 1

// its a simple jump on tap and while tap controller // for a geometry dash like game void MobileController(){         // for the touch movement         if (Input.touchCount > 0)         { 	        theTouch = Input.GetTouch(0);  	        if ((theTouch.phase == TouchPhase.Began || theTouch.phase == TouchPhase.Stationary              || theTouch.phase == TouchPhase.Moved) && isGrounded)         	{ 	        	myRigidbody.AddForce(Vector3.up * (jumpPower * myRigidbody.mass * myRigidbody.gravityScale * 10.0f));                 myAudioPlayer.PlayOneShot(jump);                 isGrounded = false;         	}         }     }

Code Example 2

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class Movement : MonoBehaviour { 	//variables 	public float moveSpeed = 300; 	public GameObject character;  	private Rigidbody2D characterBody; 	private float ScreenWidth;   	// Use this for initialization 	void Start () { 		ScreenWidth = Screen.width; 		characterBody = character.GetComponent<rigidbody2d>(); 	} 	 	// Update is called once per frame 	void Update () { 		int i = 0; 		//loop over every touch found 		while (i < Input.touchCount) { 			if (Input.GetTouch (i).position.x > ScreenWidth / 2) { 				//move right 				RunCharacter (1.0f); 			} 			if (Input.GetTouch (i).position.x < ScreenWidth / 2) { 				//move left 				RunCharacter (-1.0f); 			} 			++i; 		} 	} 	void FixedUpdate(){ 		#if UNITY_EDITOR 		RunCharacter(Input.GetAxis("Horizontal")); 		#endif 	}  	private void RunCharacter(float horizontalInput){ 		//move player 		characterBody.AddForce(new Vector2(horizontalInput * moveSpeed * Time.deltaTime, 0));  	} }

Code Example 3

if (Input.touchCount > 0) { }

Learn ReactJs, React Native from akashmittal.com