unity input touch start code example
Example 1: recognizing touch input unity
if (Input.touchCount > 0) { }
Example 2: unity mobile touch input
void MobileController(){
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;
}
}
}