What's the equivalent to Input.GetButton(name) and Input.GetAxis(name)?

I know that you can bind once off presses using actions, but how do I listen for input in my update loop? I want to know every frame that a specific control is being held. What’s the best way to do comething like movement, wherein each frame of the button being held, the character is moved?
What are the equivalents to Input.GetButton() and Input.GetAxis() in the Input System?

This sounds like simple stuff, but I just can’t find the documentation for it.

Furthermore, is there any equivalent to Input.GetButtonDown() and Input.GetButtonUp() that could be used in update to make the new input system more usable?

1 Like

Came here looking for the Input.GetAxis(“Mouse Y”) equivalent as well.

Some migration help can be found here in the docs.

if (Mouse.current.leftButton.isPressed)
   /* ... */;

There is wasPressedThisFrame and wasReleasedThisFrame. In general, though, would recommend not using them and using actions instead as the current implementation of wasXXXThisFrame is simply based on comparing the current state to the state from the last frame – which won’t give the expected behavior for state changes within frames.

Mouse.current.position.ReadValue().y
2 Likes

Continuing with this original question, is there something like:

UnityEngine.InputSystem.PlayerInput playerInput = ...;
bool jump = playerInput.GetActionDown("Jump");

That would be just great

1 Like
bool jump = playerInput.actions["jump"].triggered;
1 Like

Is there a similar trick for touch holding on mobiles?

What about something like

if(BitConverter.ToBoolean(Vive_RawByteArray,0) == true)
{
OnViveGripButtonDown.Invoke();
}

Basically wondering what the setup would be for getting the Native Array of bytes that the Input System uses. Using the debugger I can see the offsets and know where they are mapped, but dont yet know how to get that data.

I see the above post but it requires you to put in “Jump”. Looking for a way to create references and check them.

Sorry I forgot to reply. That was SUPER useful, thanks a lot :slight_smile: