Why does the Player Input Component trigger three times?

I’ve set up a very basic example where the “Fire” action from the example prints a message. “One” is subscribed to the performed-Event and “Two” is connected through the Player Input Component:

6286889--695204--upload_2020-9-7_19-6-5.png

Shouldn’t these be exactly the same? Why is “Two” printed twice when I press the button and a third time when I release it, but “One” only prints once when I press the button down?

6286889--695201--upload_2020-9-7_19-5-43.png

Inputexample actions;

private void OnEnable()
{
    actions = new Inputexample();
    actions.Enable();

    actions.Player.Fire.performed += One;
}

public void One(InputAction.CallbackContext context)
{
    Debug.Log("One");
}

public void Two(InputAction.CallbackContext context)
{
    Debug.Log("Two");
}

Check the context phase. It might be performing “started” “performed” and “cancel”

1 Like