# \[Enhanced Input\] Inconsistent Behavior when flushing pressed keys

**URL:** <https://forums.unrealengine.com/t/enhanced-input-inconsistent-behavior-when-flushing-pressed-keys/1260020>\
**Category:** C++\
**Tags:** Input, unreal-engine, CPP\
**Created:** [August 13, 2023, 9:53pm UTC](https://forums.unrealengine.com/t/enhanced-input-inconsistent-behavior-when-flushing-pressed-keys/1260020 "2023-08-13T21:53:31Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![atlantiq](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atlantiq](https://forums.unrealengine.com/u/atlantiq)\
**Post date:** [August 13, 2023, 9:53pm UTC](https://forums.unrealengine.com/t/enhanced-input-inconsistent-behavior-when-flushing-pressed-keys/1260020/1 "2023-08-13T21:53:31Z")

</div>

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](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/4/d/44d97c69ebca4c452f67179b00d18dd6660a115d.png)

2. Bind input to Call flush pressed keys (I used debug input and exposed PC-\>FlushPressedKeys() to BP)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/e/e5e3b181cd5a9ff2691e24541d76292408855712.png)

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.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/f/b3f3c1f0454b717975a2a5cd4163f1f5b9beef92.png)

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

---

_[View the full topic](https://forums.unrealengine.com/t/enhanced-input-inconsistent-behavior-when-flushing-pressed-keys/1260020)._
