Input.GetKeyUp for Input.GetAxisRaw

I’m following this tutorial on making a platformer, but instead of using the Input.GetKeyDown(“space”) to jump I chose Input.GetAxisRaw(“vertical”) == 1. In the tutorial he uses Input.GetKeyUp(“space”) to signify when to reduce the vertical velocity.

Is there a way to do this for Input.GetAxisRaw(“vertical”) == 1 without creating an additional variable?

(tutorial’s code snippet)

if (Input.GetKeyUp("space")) {
    // Do thing

(example of what I don’t want to do)

bool wasJumpingInLastFrame;

if (wasJumpingInLastFrame && Input.GetAxisRaw == 0) {
    // Do thing after involving additional variable

if (Input.GetAxisRaw("vertical") == 1) {
    wasJumpingInLastFrame = true;
} else {
    wasJumpingInLastFrame = false;

Change 6 to “Vertical” (case matters for Axes strings, assuming you haven’t changed that in your Axes control panel).

I don’t see what you are concerned about with the variable - looks like you swapped a hard-coded Input.GetKey(space) with a Player Settings Input.GetAxis.