In some instances, like when you’re making an RPG with point-and-click controls or when the player interacts with your UI, you might want to display a custom mouse cursor or a crosshair instead of the default mouse pointer. The good news is that it’s easy to implement in Unreal Engine.
1. Create or download the cursor image
First things first — you need to have the cursor/crosshair image. Either create one or download it from somewhere. If you’re not an artist or want to save yourself some time, I can suggest downloading Kenney’s Crosshair Pack.
2. Create a Widget Blueprint
For starters, you will need to import the image into the engine.
Then go ahead and create a new Widget Blueprint by right-clicking on an empty place in the Content Browser and selecting User Interface → Widget Blueprint. Call it something meaningful like WBP_MouseCursor.
Open it and set it up:
- Drag an image onto the default Canvas.
- Change the display mode in the upper-right corner of the screen to Desired on Screen.
- Change the anchor/position of the image to Center. This can be quickly done by holding Ctrl+Shift and clicking the appropriate anchor point in the dropdown.
You should end up with this hierarchy:
3. Change interface settings
Open Edit → Project Settings, and find the User Interface section in the Engine group. Find where it says Software Cursors and click the + button to add a new element.
On the left side, select Default, and on the right, select the widget blueprint you’ve just created. You should end up with something like this:
Note that this will replace the default cursor that will show up everywhere. If you want to have context-sensitive cursors, you’ll need to do additional setup and coding. There’s this article, for example.
After all of this, you should end up with your custom mouse cursor showing up instead of the default mouse pointer:
Leave a Comment