[Bug report] Losing focus / input axis values 0 after releasing mouse button.

Since this was a very popular answer to many very popular questions (it’s a known bug in the engine for a long time), here we go UE5.1.1.

If you lose your input functionality after releasing a mouse button and your input axis floats begin reading 0, you are looking at the following problem:

This is a problem with how your player controller settings are treated in the engine, in the SceneViewport. Apparently if you combine the playercontroller settings "bShowMouseCursor " set to true and the input mode set to “Game”, the viewport will lose focus each time you lift any mouse button, resulting in the axis value reading 0 and breaking your controls.
This is something which has been discussed over the years but no one came up with a fix.

I modified quite a few things in my project, but from memory my workaround to be able to use the mouse in input mode game, is to re apply the input mode whenever the bug triggers:
PlayerControler, on event any key:

if (bShowMouseCursor && InKey.IsMouseButton() && (InEventType == EInputEvent::IE_Released) && (InputMode == E_PlayerControllerInputModes::Game)) {
	// Simply re-applying the Game input mode seems to do the trick.
	ActivateInputModeGame();		
}