Skip to content

Instantly share code, notes, and snippets.

@baileysh9
Last active April 1, 2016 16:11
Show Gist options
  • Save baileysh9/c7ed7b4248b8ef5537d2be9d680d6ea9 to your computer and use it in GitHub Desktop.
Save baileysh9/c7ed7b4248b8ef5537d2be9d680d6ea9 to your computer and use it in GitHub Desktop.
Unity Mobile Input
void Update () {
if (Input.touchCount == 1) {
//Get the player and camera objects
GameObject player = GameObject.FindGameObjectWithTag ("Player");
GameObject camera = GameObject.FindGameObjectWithTag ("MainCamera");
//Change the character's position by moving in the direction that the camera is facing
player.transform.position = player.transform.position + camera.transform.forward;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment