Ok, the problem is completely different than I thought.
I create the level and show an UMG menu.
Everything is ok.
As soon as I click one of the UMG controls (even if I do nothing then), the GetFirstPlayerController seems to be not active anymore.
I click in the world, everything ok, I click the UMG button/canvas, the GetFirstPlayerController is not active.
I can play this game endlessly.
So, how do I put the control back to the PlayerController after clicking the UMG GUI?
It is important to call only one of these in a short time.
If you have code which calls first one of the above methods and then another one, chances are, it will not work. Clean your code.
I do only use allowInputUiOnly and allowInputGameAndUi, because I don’t like that allowInputGameOnly holds the cursor hostage inside the game window.
I ended up solving this for my project like this in C++:
void AVeilPlayerController::SetMouseCursor(TEnumAsByte<EMouseCursor::Type> NewCursor)
{
CurrentMouseCursor = NewCursor;
/*Force the new cursor to show even when no cursor input*/
float X, Y = 0.f;
GetMousePosition(X, Y);
SetMouseLocation(X, Y);
}