Setting a custom hardware cursor does not work unless the mouse cursor re-enters the active game window

I know this is old but thanks so much!!!

Hi, is it possible to call MouseEnter from blueprints? I dont have a custom viewport in C++, I have a HUD widget displayed on screen all the time, and I can call there MouseEnter if possible? If yes, how? Thanks.

I collected all information I could find, and made this video, which hopefully explains a bit more how to do it.

In short for hardware you need to set specific directory in your non-asset include in packaging, then create a subclass of viewport and add the MouseEnter(Viewport, 0, 0); suggested above. The video shows also the code and clicks needed.

1 Like

This mostly worked, thank you so much! I didn’t know how to execute this though, but I found a step-by-step walkthrough of exactly how to make that custom game viewport class, here:


However, this approach does reset the mouse cursor position to the top left of the screen, which isn’t all that nice either. So I tried adding this:

FVector2D mousePos{};
if (!GetMousePosition(mousePos))
	mousePos.X = mousePos.Y = 0;
MouseEnter(Viewport, mousePos.X, mousePos.Y);

However, the call to GetMousePosition fails so this doesn’t work. I guess this is too early in the init process? Any idea how to do this trick without moving the cursor position, or, alternatively, while centering the cursor instead of putting it in the top-left?

Another problem with this solution is that dynamically switching the cursor (for example on hover-over) still doesn’t work until the user has clicked. That’s much less of a problem, though.