// Update is called once per frame void Update() { for (int i = 0; i < Input.touchCount; i++) { Vector3 touchPosition = Camera.main.ScreenToWorldPoint(Input.touches[i].position); Debug.DrawLine(Vector3.zero, touchPosition, Color.red); if (touchPosition.x > 0) { carMovement.MoveRight(); } else if (touchPosition.x < 0) { carMovement.MoveLeft(); } else { carMovement.MoveStop(); } Debug.DrawLine(Vector3.zero, touchPosition, Color.red); } //if(Input.touchCount > 0) //register all touches (max 5) // { // Touch touch = Input.GetTouch(0); // Vector3 touch_Position = Camera.main.ScreenToWorldPoint(touch.position); //Change screen coord. into world coord. // if(touch_Position.x > 0) // { // carMovement.MoveRight(); // } // else if (touch_Position.x < 0) // { // carMovement.MoveLeft(); // } // else // { // carMovement.MoveStop(); // } // } }