[Enhanced Input] Inconsistent Behavior when flushing pressed keys

If you call flush keys on the player controller while using enhanced input, you get unexpected behaviours.

  1. Setup an input action with the down trigger
    image

  2. Bind input to Call flush pressed keys (I used debug input and exposed PC->FlushPressedKeys() to BP)
    image

  3. Now run the game, hold the input action button down and press the key to flush player input. Observe that the input action receives both triggered and completed events. What I expect to happen is both triggered and completed events don’t get called once flushing keys.

Seems like the cause for this behavior is from UEnhancedPlayerInput::ProcessInputStack. The function handles IE_Repeat as input down but even the old input system doesn’t use IE_Repeat at all.

Removing the check to look for KeyState.EventCounts[IE_Repeat].Num() fixes the issue.

4 Likes