October 28, 2020
Cursory
The Slate framework for Unreal Engine 4 is responsible for deciding which cursor is shown on the screen at any given time. It makes this decision by looking at a few different sources. Cursory manages one cursor, and it makes it easy for you to ensure that all sources point to that cursor.
The Slate framework looks at two sources when deciding which cursor to show: player controllers and widgets. To make things more complicated, player controllers and widgets maintain their own cursors. Typically, cursor selection follows this priority:
ShowMouseCursor
property is false, no cursor is shown. Otherwise...This can introduce quite a bit of confusion, in terms of where a cursor is coming from at any point in time. Cursory simplifies this by maintaining one cursor and ensuring that all other sources point to that cursor. We recommend conforming all player controllers and widgets using the methods provided below, to ensure maximum consistency.
To conform a player controller, simply add the CursoryConformerComponent
to the controller from Blueprints or C++.
The player controller cursor will automatically be synchronized with Cursory.
If you ever want to stop syncing a player controller to Cursory, you can simply
Deactivate()
the Conformer component. When you want to resume synchronization, justActivate()
.
To conform a widget, call one of the conformance functions provided in the CursoryFunctionLibrary
:
ConformWidgetToCursory
- Synchronizes a UWidget
(such as a button)ConformWidgetsToCursory
- Synchronizes a list of UWidget
sConformWidgetToCursory (Recursive)
- Sychronizes a UUserWidget
(i.e. a WidgetBlueprint) and all of its children (prefer this option in most cases)Using any of these methods will synchronize your widgets with Cursory.
If you ever want to stop syncing a widget to Cursory, use the
SetCursor()
orResetCursor()
functions. To resume synchronization, use one of the methods above.