Affected versions:
- 4.17.1
- 4.17
- 4.16 (Tested only under Play In Editor functionality)
Description:
Setting a custom hardware cursor does not work unless the mouse cursor enters the active game window. That is, it doesn’t set the cursor when you launch the game (doesn’t matter PIE or standalone) when the cursor is over the active agme window. Even if you click the atcive window, nothing happens. However, if you move the mouse outside of the active game window and then mouse in back in, it will start working correctly and set desired cursor(s) (at this point you can even change the cursors dynamically without re-entering, it will work as intended).
Steps to reproduce:
- Download relevant source code from Github as packaged .zip archive.
- Run “Setup.bat” and wait for it to finish.
- Run “GenerateProjectFiles.bat” and wait for it to finish.
- Open generated .sln file in Visual Studio 2015 (Enterprise Update 3, but shouldn’t matter) and build solution.
- Launch compiled Unreal Editor.
- Create a blank C++ project from the C++ tab by selecting “Baic Code” (No starter content, but shouldn’t matter).
- Sub-class
GameModeBase
as a BluePrint class and set it inEdit -> Project settings -> Maps & Modes -> Default GameMode
. - [Optionally] Sub-class
PlayerController
as a C++ class and add code to set/change hardware cursor dynamically. - Sub-class
PlayerController
as a BluePrint class and set it in the project settings under earlier set GameMode. - Open “Class Defaults” of the sub-classed BP PlayerController by double clicking the asset in content manager and enable “Show Mouse Cursor”.
- Create a directory called “Slate” in projects’ “Content” folder and place desired custom cursor image with .png extension.
- Set/add hardware cursor in
Edit -> Project settings -> User Interface -> Hardware Cursors
, specifying the relative path to your added .png cursor (i.e.: “Slate/cursorFileName”). Change cursor type from “None” to “Default”. - Save level.
- “Save all” in content manager.
- Click “Compile” and wait for it to finish.
- Press “Play” to start a ‘PIE’ (Play In Editor) session and witness the bug.