Mouse Cursor limited to screen

There are three input modes I know of:

  • FInputModeUIOnly
  • FInputModeGameOnly
  • FInputModeGameAndUI

FInputModeGameAndUI has “SetLockMouseToViewport”

Just an idea.

As info, my code looks like this:

void
YourClass::allowInputGameAndUi()
{
	FInputModeGameAndUI inputMode;
	inputMode.SetLockMouseToViewport(false);
	inputMode.SetWidgetToFocus(nullptr);
	inputMode.SetHideCursorDuringCapture(false);

	FSlateApplication::Get().SetUserFocusToGameViewport(0);

	APlayerController* pPc = GetWorld()->GetFirstPlayerController();
	pPc->SetInputMode(inputMode);
 }