Skip to content

Instantly share code, notes, and snippets.

@cyberjj999
Created May 7, 2022 03:42
Show Gist options
  • Save cyberjj999/798a83d65c457ff61178a18dadec036a to your computer and use it in GitHub Desktop.
Save cyberjj999/798a83d65c457ff61178a18dadec036a to your computer and use it in GitHub Desktop.
Becoming A Metaverse Developer Article | Update() Method
// Update is called once per frame
void Update()
{
// If user press Space and is on the ground
if (Input.GetKeyDown(KeyCode.Space) && IsGrounded())
{
// Jump is set to true
toJump = true;
}
// Get horizontal and vertical inputs from user
// (horizontal input are 'A' and 'D' keys, or left/right arrow keys)
// (vertical input are 'W' and 'S' keys, or up/down arrow keys)
horizontalInput = Input.GetAxis("Horizontal");
verticalInput = Input.GetAxis("Vertical");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment