Holding Down Key While Loading New Level Drops Input

I’m working on a paper2d metroidvania style game where the character loads a new level when they walk through a doorway.

I’m encountering some weird behavior when my character walks through the loading zone using keyboard controls.

SCENARIO #1 BUTTON PRESSES: If I have my keyboard controls bound to action mappings (not an axis), then when the level loads and the player spawns in, the blueprint does not detect that the button as being held down. Using the “Input Held Down” function will always return false.

I’ve tried solving this by using a save game slot to store whether the button was held down; however, the problem with this solution is that it cannot detect if I held it down while moving through a loading zone and then released it on the same frame that the level loaded in (which would make my character walk forward without any keys being pressed).

This is a big problem for not just my movement keys, but for other held buttons as well.

SCENARIO #2 AXIS MAPPINGS: If I map left and right on my keyboard to an axis, then I can hold the forward button down to go through doors and continue moving forward after the level loads; however, if I jump through a door, the axis value becomes 0 when I respawn. Conversely, if I do the same thing using a controller instead of a keyboard, it works fine. EDIT: Turns out that this is because pressing the space button on any keyboard will stop the output of other keys, you can try this yourself by opening wordpad, holding down a key (D for instance) and then pressing space button while it is held down - this should stop the D output.


If I can get the “Input Held Down” function to be able to detect buttons that were being held down before the level loaded, then I think all of my issues would be solved. The issue with the axis mappings would also be nice to solve, but it doesn’t solve the problem of buttons that aren’t mapped to axes.

I think the player controller ( which reads input ) gets replaced when you change levels.

One way to avoid it is to use level streaming, then you can do things at your own pace.

Having said that, if you want to keep things as they are, you could use a workaround. Just before you change levels, store a flag in the game instance ( which is continuous ), so that they new level knows if a key was held, and can fake it to start with.

There may also be other methods I’m not aware of.

Half a button press in SM64. If I were you I’d keep a variable that checks to see if the button was released when the level ends. However, this may allow the player to release the button while the new level is loading which would create an inaccurate input.

Yeah I tried that with scenario 1 using a saved variable, but it def dropped the release during level load

Trying to avoid level streaming to achieve the effect I want.

As for storing it in the game instance, I’m not too sure how to do that and worry that if I store it as anything anywhere I’ll run into the problem of the engine not registering me releasing a button while the game is in a loading state

Yeah, using level streaming seems like it would be a bit of a pain in the butt to make everything fit and transition into each other