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.
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.
To feed into this, you need an entire game loop. You will find if you add an intro movie to your project, such as a cutscene or logo, place your hardware set cursor code on the construction of your first widget or any where else appropriate, the behaviour you get will be⌠Player loads game - black screen as movie loads, cursor displays (non hardware), movie plays, player clicks to skip or movie ends naturally and then the next screen your widget will display hardware cursor and for every screen onwards. This closed loop is probably why Epic have never changed this behaviour.
This still is a working solution for 5.4, thanks