Description

From the user: 

The root of the problem appears to be that KeyState.EventAccumulator still has events stored in the structure for 'LeftAlt'. So, although UPlayerInput::FlushInput is called when the window loses focus - and resets the bDown and bDownPrevious values, it doesn't clear EventAccumulator, which will subsequently process and result in the 'LeftAlt' key being marked as still held down.

 

For reference, here is the code for resetting the KeyState in UPlayerInput::FlushInput

for (TMap<FKey,FKeyState>::TIterator It(KeyStateMap); It; ++It)

Unknown macro: { FKey& Key = It.Key(); FKeyState& KeyState = It.Value(); KeyState.RawValue = FVector(0.f, 0.f, 0.f); KeyState.bDown = false; KeyState.bDownPrevious = false; KeyState.LastUpDownTransitionTime = TimeSeconds; }

 

As a test, I tried clearing the KeyState's event accumulator

Unknown macro: { ... KeyState.RawValue = FVector(0.f, 0.f, 0.f); KeyState.bDown = false; KeyState.bDownPrevious = false; KeyState.LastUpDownTransitionTime = TimeSeconds; *KeyState.EventAccumulator->Reset();* }

 

which solves the issue, but I'm unsure of other knock on effects. I also tried calling DiscardPlayerInput(); at the end of FlushPlayerInput() and that also solved the issue.

Steps to Reproduce
  • Boot up lyra
  • Select the game, which triggers the level load
  • While the level is loading, alt+tab out of the game
  • Showdebug Input
  • When the game is loaded, PlayerInput will report that 'LeftAlt' is still held down

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-205014 in the post.

0
Login to Vote

Fixed
ComponentUE - Gameplay - Input
Affects Versions5.45.05.15.25.3
Target Fix5.5
Fix Commit21189897
CreatedJan 26, 2024
ResolvedApr 30, 2024
UpdatedOct 16, 2024
View Jira Issue