I’ve been looking into making a cursor that would work well with a small project I’m playing around with, but it’s been surprisingly hard.
Here are the things I’ve tried so far [And the problem with it]:
- Use default hardware cursor by just setting bShowMouseCursor in my playercontroller (I want to have a custom cursor, so doesn’t work]
- Use custom hardware cursor by having bShowMouseCursor, setting the DefaultMouseCursor/CurrentMouseCursor and setting a custom HCURSOR using ((FWindowsCursor*)FSlateApplication::Get().GetPlatformCursor()).SetCustomShape(LoadCursorFromFile(…)) [This seemed to work, but has the UMG problem described below]
- Use custom software cursor by rendering using slate and drawing UMG widgets as a part of the slate UI, but rendering the cursor on the top. [This has the UMG problem as well, but also has problems with the cursor freezing completely when holding down the mouse on a UMG widget. I suppose the UMG widgets are returning handled on the FReply’s, which stops the slate callbacks from being run.]
- Use the Default Cursor setting in Project Settings->User Interface [Also has the UMG problem, but as a twist, it duplicates the cursor and draws it a bit smaller and lighter to the top left of the main cursor]
The UMG cursor problem I mention is that when I press down on a UMG button, the system shows the default windows cursor again, until I click the game window once more. It kind of looks like the game window loses focus completely and needs to be refocused. I tried to run SetFocus on the HWND to see if that would fix it, but in my case it did not.
The only other thread I’ve found that seems to have similar symptoms is a thread from a year ago:
where Rudy Triplett gives a hackish solution to the op’s problem. I haven’t tried this solution, but it seems so roundabout I would not be happy with using it anyhow.
Has anyone else run into this problem and found a good solution I wonder?
My next step will be looking around in the source and see if I can see what is going wrong, but before starting that I thought I would post and see if someone has some wisdom to share