# UE5 Enhanced Input Bug after open New Level ?

**URL:** <https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, bug-report, question\
**Created:** [August 15, 2023, 5:16am UTC](https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501 "2023-08-15T05:16:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anonymous\_3cd4412808c3c3d80d6de5fa14e25f8b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_3cd4412808c3c3d80d6de5fa14e25f8b](https://forums.unrealengine.com/u/Anonymous_3cd4412808c3c3d80d6de5fa14e25f8b)\
**Post date:** [August 15, 2023, 5:16am UTC](https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501/1 "2023-08-15T05:16:04Z")

</div>

When I press and hold a button, it will call the start event and wait for me to release it to call the complete event. However, if I open a new level before releasing the button, it will jump to the next level and repeatedly call the start event and complete event until I haev release the button or press another one. How can I solve this problem?

---

<div class="post-metadata">

**Author:** ![AreWeGaming](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arewegaming/32/1174860_2.png) [@AreWeGaming](https://forums.unrealengine.com/u/AreWeGaming)\
**Post date:** [August 15, 2023, 5:21am UTC](https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501/2 "2023-08-15T05:21:16Z")

</div>

Run a Check (Branch) to make sure you’re still pressing and or if are still pressing

---

<div class="post-metadata">

**Author:** ![Anonymous\_3cd4412808c3c3d80d6de5fa14e25f8b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Anonymous\_3cd4412808c3c3d80d6de5fa14e25f8b](https://forums.unrealengine.com/u/Anonymous_3cd4412808c3c3d80d6de5fa14e25f8b)\
**Post date:** [August 15, 2023, 7:25am UTC](https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501/3 "2023-08-15T07:25:41Z")

</div>

I suppose what I need is to make sure all the input cache is flush after opne new level, currently , right now I use some code like

```auto
			if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(locP))
			{
				UEnhancedPlayerInput* EnhancedPlayerInput = Subsystem->GetPlayerInput();
				EnhancedPlayerInput->FlushPressedKeys();
				EnhancedPlayerInput->ActionMappings.Empty();
				//controller->FlushPressedKeys();

				FModifyContextOptions op;
				op.bForceImmediately = true;
				op.bIgnoreAllPressedKeysUntilRelease = true;
				Subsystem->AddMappingContext(megaInputContext, 0 , op);
                        }

```

But I still get the some problem

---

<div class="post-metadata">

**Author:** ![CoolHandNick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CoolHandNick](https://forums.unrealengine.com/u/CoolHandNick)\
**Post date:** [September 26, 2023, 8:30am UTC](https://forums.unrealengine.com/t/ue5-enhanced-input-bug-after-open-new-level/1261501/4 "2023-09-26T08:30:08Z")

</div>

Hello, it seems to work using this solution for a similar problem attempting flushing pressed key: [[Enhanced Input] Inconsistent Behavior when flushing pressed keys](https://forums.unrealengine.com/t/enhanced-input-inconsistent-behavior-when-flushing-pressed-keys/1260020)
