There's a better way to test for a button press with the InputSystem!

Hi all,

If you’ve followed previous practice and used:

    [SerializeField] InputAction actionButtons;

In a similar way to what you did for movement, then after you’ve done the OnEnable() and OnDisable() bit and set the binding (e.g. I used space bar), use this:

        if (actionButtons.IsPressed()){
            Debug.Log("Firing");
        } else {
            Debug.Log("NOT");
        }

Note that IsPressed is a function, and therefore must be IsPressed().

2 Likes

Privacy & Terms