Skip to main content
2 of 6
added 22 characters in body
tyjkenn
  • 2.6k
  • 18
  • 24

I'm not sure you can use key combinations as input, so you may need to set up two buttons and then check for a GetButton on the shift during a GetButtonDown on the W.

Input manager configuration:

Sprint
  Positive Button: w
Shift
  Positive Button: left shift
  Alt Positive Button: right shift

That will allow either shift to be used. If you don't want that, leave the Alt Positive Button blank. Negative buttons and other alt buttons can be left blank. All the other settings should be fine.

Then your code would look something like this:

if (isGrounded && Input.GetButton("Shift") && Input.GetButtonDown("Sprint")) {
    isRunning = true;
}

if (Input.GetButtonUp("Shift") || Input.GetButtonUp("Sprint")) {
    isRunning = false;
}
tyjkenn
  • 2.6k
  • 18
  • 24