Unity Input System Issue using Starter Assets Input (First Person Core)

I’m trying to add a button to allow the player to interact with objects in my game using the E key, but for some reason unity isn’t recognizing the input.

I’ve followed the existing structure of the first person core sample and done the following:

  1. Added the input action to the existing “Player” actionmap where all other inputs are stored (move, look, jump, sprint)
  2. Edited the StarterAssetsInput.cs, copied all code for the “jump” input while renaming anything labeled “jump” to “interact”
public bool interact;
////////
public void onInteract(InputValue value)
{
	InteractInput(value.isPressed);
}
////////
public void InteractInput(bool newInteractState)
{
	interact = newInteractState;
}
  1. Created a new function to test the interaction
private void DoInteract()
{
    if (_input.interact)
    {
        UnityEngine.Debug.Log("Interacted, but nothing to interact with");
    }
}
  1. Added that function to the “Update” function:
private void Update()
{
    JumpAndGravity();
    GroundedCheck();
    Move();
    DoInteract();
}

This seemingly did nothing, when i tested the key nothing happened. nothing in the log.

So I tried changing the “jumpandgravity” from _input.jump to trigger the action to _input.interact. This removed the ability to jump but did not show anything in the debug log.

So i changed the actual button for the jump action to E and tested again (after changing back to input.jump) and that allowed me to jump using the E button.

Why is _input.interact not working??

I managed to get it working somehow but have a different issue now instead of acting like a single button press when i press the key it acts like i’m just holding the button down.

I can get around this by just adding some code to the “DoInteract” function

private void DoInteract()
{
    if (_input.interact)
    {
        didInteract = true;
    }
    if (didInteract)
    {
        UnityEngine.Debug.Log("Interacted, but nothing to interact with");
        didInteract = false;
        _input.interact = false;
    }
}

But this feels like a hack that i shouldn’t have to do. I know game development can be very hacky but this feels like unnecessary hacking.