I just tracked down the root of this bug, and it is pretty silly.
The issue stems from PIE and Editor sharing a common instance of FSlateUser
, so when you use a GamePad in PIE, it switches the ActiveInputMode
from ECommonInputType::MouseAndKeyboard
to ECommonInputType::Gamepad
, and hides the mouse in FCommonAnalogCursor::RefreshCursorVisibility()
From there, the call to SlateApp.SetPlatformCursorVisibility(false)
ultimately calls FSlateUser::SetCursorVisibility
which sets the bCanDrawCursor
property to false.
If you then stop the PIE session WHILE USING THE GAMEPAD, then bCanDrawCursor
will remain false, and you may not have a cursor in the editor.
At this point, you can get it back by right clicking in a viewport and such, but THEN any time you begin a drag action (such as moving a node, connecting a wire, adding a UI element, etc.) that pesky bCanDrawCursor
flag is STILL FALSE, and so when FSlateUser::ProcessCursorReply
is called, the second IF statement is false, so it immediately drops down to Cursor->SetType(EMouseCursor::None)
, and poof your mouse is gone AGAIN.
At the moment, I don’t see anything setting bCanDrawCursor
back to true in the Editor itself, aside from running the game again, and using the mouse and keyboard to exit the game while the cursor is visible.
I imagine that a simple call to FSlateUser::SetCursorVisibility(true)
when PIE is stopped would fix the issue, but I am currently using a vanilla version of UE5.