Having issues hiding mouse

This is much easier to show than explain so I made a short video demonstrating my two issues.

ISSUE 1: Disabling / unsetting bShowMouseCursor doesn't seem to undo everything that setting bShowMouseCursor does (IE setting bShowMouseCursor enables the mouse and starts tracking it, unsetting bShowMouseCursor just hides it).

ISSUE 2: Mouse doesn’t even show up in the play in editor views. Only in standalone.

I know this has come up but the solutions seemed very hacky. Any help would be greatly appreciated.

// Called to bind functionality to input
void AVehicleEditorPawn::SetupPlayerInputComponent(class UInputComponent * InputComponent)
{
	Super::SetupPlayerInputComponent(InputComponent);

	InputComponent->BindAction("Secondary",
		IE_Pressed, this, &AVehicleEditorPawn::SecondaryPressed);
	InputComponent->BindAction("Secondary",
		IE_Released, this, &AVehicleEditorPawn::SecondaryReleased);

	// ...
}

void AVehicleEditorPawn::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	static auto * const PlayerController = GetWorld()->GetFirstPlayerController();

	// Enable / disable cursor based on Secondary
	PlayerController->bShowMouseCursor = !SecondaryCurrentlyPressed;
	PlayerController->bEnableClickEvents = !SecondaryCurrentlyPressed;
	PlayerController->bEnableMouseOverEvents = !SecondaryCurrentlyPressed;

	// ..
}

// Secondary Pressed
void AVehicleEditorPawn::SecondaryPressed()
{
	SecondaryCurrentlyPressed = true;
}

// Secondary Released
void AVehicleEditorPawn::SecondaryReleased()
{
	SecondaryCurrentlyPressed = false;
}

A few things to try:

Make sure to set your default mouse cursor on your player controller at some point:

CurrentMouseCursor = EMouseCursor::Default;

Use SetInputMode(…) on your player controller when you want to capture the mouse (e.g. control a vehicle or the camera). This will fix your “moved to the edge of the window” problems.

Use ‘GameOnly’ for full mouse capture in the game world:

FInputModeGameOnly InputMode;
SetInputMode(InputMode);

Use ‘UI only’ when you want to only interact with screen-space widgets:

FInputModeUIOnly InputMode;
InputMode.SetLockMouseToViewport(false);
InputMode.SetWidgetToFocus(SomeWidget);
SetInputMode(InputMode);

Try playing with ‘GameAndUI’ if you want to mix behaviors:

FInputModeGameAndUI InputMode;
InputMode.SetHideCursorDuringCapture(true);
InputMode.SetLockMouseToViewport(true);
SetInputMode(InputMode);

Note that there is a limitation in UE4 at the moment where you will probably need to set your desired InputMode again when you are handling a mouse-up event.