Input Icons
Last updated
Last updated
WBP_InputIcon
is our solution to handling on-screen widgets to represent particular inputs. e.g. if you want to give a prompt for the "jump" button, it will show the key mapped to the jump button (e.g. spacebar)
Using this widget over hard-coding the icon gives us benefits such as allowing it to update automatically if the mapping for a given input changes.
This widget determines the key from the input action provided, and looks up the corresponding icon from the M2_InputIconMap
Which map is used (and so the styling of icons per key) is determined by your skin settings. By default DA_InputIconMap
is used.
NOTE: If you need any icons which aren't defined in DA_InputIconMap
you will need to supply your own map. See Using Skins with Input Icons for details on how to do this.
Add the widget.
Provide an action for the widget. This can be done in a number of ways:
Provide an InputActionName
in the Designer view.
This is the value of an "input action" in your project settings
(Note this may not be easily configurable in WorldBuilder projects)
Provide an "Enhanced input" action and mapping context for your icon in the designer view.
Update/set the the icon through BP/Code:
If the icon you're wanting to display depends on data passed through, this can be used. It works for both the standard input ActionMapping
s, or EnhancedInput
.
Support for skinning is ending soon. Please see https://docs.msquared.io/tutorials-and-features/ui/how-to-use-skins for details.
For more details on how skins work, and what they are, see How to use skins.
Create a new M2_InputIconMap
, and provide the required icons for the required keys.
(I'd recommend copying the existing DA_InputIconMap
, so that the map is largely filled in already)
In your skin's SkinSettings
, add a M2_InputIconSkinSetting
entry.
In this, provide your newly created icon map asset
We still need to fill our our icon map with all the relevant icons
The input icon widget approach will later be extended to support different control schemes, i.e. swapping out the icons when switching to using gamepad.
We will later also support "custom icon names", to provide icons for things that don't have a direct action mapping, e.g. "WASD and mouse movement, for moving and looking around