Skip to content

Instantly share code, notes, and snippets.

@curious-username
Created September 7, 2021 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curious-username/de3b77239bda8d6b15023010080fc3b9 to your computer and use it in GitHub Desktop.
Save curious-username/de3b77239bda8d6b15023010080fc3b9 to your computer and use it in GitHub Desktop.
showing example of player control in Unity
public float speed = 5.0f; // Global variable
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
transform.Translate(Vector3.right * horizontalInput * speed * Time.deltaTime);
transform.Translate(Vector3.up * verticalInput * speed * Time.deltaTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment