UGantrySettingKeyBinding
A key the player can rebind: one key slot of one of Enhanced Input's player mappable keys.
The key is read and written through the player's Enhanced Input user settings. Turn those on in Project Settings > Engine > Enhanced Input > User Settings; without them the setting is disabled.
The value is the key's name, such as "SpaceBar" or "Gamepad_FaceButton_Bottom". An empty value means no key. Apply Changes, Revert Changes and Reset To Defaults therefore work as they do for any other setting, and applying saves the player's Enhanced Input settings. Get Conflicts lists other mappings already on the same key, so your screen can warn the player.
A mapping can only be rebound once its mapping context is registered for rebinding, which the Add Input Mappings stage does. Until then the setting is disabled.
To list every rebindable key, call Add Key Bindings from a settings provider's Create Pages. Add that provider from the same experience as the Add Input Mappings stage, and after it, so the mappings exist when the page is built.
- Inherits
UGantrySettingValue
Properties
| Property | Type | Default | Description |
|---|---|---|---|
MappingName read-only | FName | None | The mapping's name: the input action's, or the one its mapping context overrides it with. |
Slot read-only | EPlayerMappableKeySlot | First | Which of the mapping's key slots this setting rebinds. |
Functions
AddKeyBindings
Adds one key binding setting for each player mappable key registered for the page's player.
Use it on a page made with New Page in a settings provider. Each setting's Id is "Keys." followed by the mapping's name and the slot's number ("Keys.Jump.0"), and its display name is the mapping's own.
| Pin | Type | Direction | Description |
|---|---|---|---|
Page | UGantrySettingsPage* | in | The page, made by a settings provider for one player. |
Slot = First | EPlayerMappableKeySlot | in | Which slot each setting rebinds. |
| Return Value | TArray<UGantrySettingKeyBinding*> | out | The settings added, sorted by category and then by name; none for a page asset. |
ClearKey
Empties the slot.
GetConflicts
Other mappings already on the key in the slot.
| Pin | Type | Direction | Description |
|---|---|---|---|
| Return Value | TArray<FText> | out | Their names for the player; empty when the key is free (or there is none). |
GetDisplayCategory
| Pin | Type | Direction | Description |
|---|---|---|---|
| Return Value | FText | out | The mapping's category for the player, as the mapping context or input action gives it. |
GetKey
| Pin | Type | Direction | Description |
|---|---|---|---|
| Return Value | FKey | out | The key in the slot; an invalid key when there is none. |
GetKeyText
| Pin | Type | Direction | Description |
|---|---|---|---|
| Return Value | FText | out | The key's name for the player, or empty when there is none. |
SetKey
Puts a key in the slot.
| Pin | Type | Direction | Description |
|---|---|---|---|
Key | FKey | in |
C++
Public C++ members that Blueprint does not see.
HasDefault
virtual bool
Whether the mapping is registered for the player, so it has a default key.
ResetToDefault
virtual void
Puts the mapping's default key back in the slot.
Apply
virtual void
Applies the value, then applies and saves the Enhanced Input user settings.
ReadValue_Implementation
virtual FString
Returns: The slot's key's name; empty when there is none.
GetDefaultValueString
virtual FString
Returns: The mapping's default key's name.