Navigation
API > API/Plugins > API/Plugins/EnhancedInput
The Enhanced Input User Settings class is a place where you can put all of your Input Related settings that you want your user to be able to change. Things like their key mappings, aim sensitivity, accessibility settings, etc. This also provides a Registration point for Input Mappings Contexts (IMC) from possibly unloaded plugins (i.e. Game Feature Plugins). You can register your IMC from a Game Feature Action plugin here, and then have access to all the key mappings available. This is very useful for building settings screens because you can now access all the mappings in your game, even if the entire plugin isn't loaded yet.
The user settings are stored on each UEnhancedPlayerInput object, so each instance of the settings can represent a single User or Local Player.
To customize this for your game, you can create a subclass of it and change the "UserSettingsClass" in the Enhanced Input Project Settings.
| Name | UEnhancedInputUserSettings |
| Type | class |
| Header File | /Engine/Plugins/EnhancedInput/Source/EnhancedInput/Public/UserSettings/EnhancedInputUserSettings.h |
| Include Path | #include "UserSettings/EnhancedInputUserSettings.h" |
Syntax
UCLASS (MinimalAPI, Config=GameUserSettings, DisplayName="Enhanced Input User Settings",
Category="Enhanced Input|User Settings")
class UEnhancedInputUserSettings : public USaveGame
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → USaveGame → UEnhancedInputUserSettings
Classes
| Name | Remarks |
|---|---|
| FEnhancedInputUserSettingsApplied | Called after the settings have been applied from the ApplySettings call. |
| FEnhancedInputUserSettingsChanged | Fired when the user settings have changed, such as their key mappings. |
| FMappableKeyProfileChanged | Fired when you equip a different key profile |
| FMappingContextRegisteredWithSettings | Registering input mapping contexts for access to them from your UI, even if they are from a plugin Fired when a new input mapping context is registered. |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnKeyProfileChanged | FMappableKeyProfileChanged | UserSettings/EnhancedInputUserSettings.h |
|
|
| OnMappingContextRegistered | FMappingContextRegisteredWithSettings | UserSettings/EnhancedInputUserSettings.h | ||
| OnSettingsApplied | FEnhancedInputUserSettingsApplied | UserSettings/EnhancedInputUserSettings.h |
|
|
| OnSettingsChanged | FEnhancedInputUserSettingsChanged | UserSettings/EnhancedInputUserSettings.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void ApplySettings () |
Apply any custom input settings to your user. | UserSettings/EnhancedInputUserSettings.h |
|
virtual void AsyncSaveSettings () |
Asynchronously save the settings to a hardcoded save game slot. | UserSettings/EnhancedInputUserSettings.h |
|
virtual UEnhancedPlayerMappableKeyProfile * CreateNewKeyProfile
(
const FPlayerMappableKeyProfileCreationArgs& InArgs |
Creates a new profile with this name and type. | UserSettings/EnhancedInputUserSettings.h |
|
virtual const FPlayerKeyMapping * FindCurrentMappingForSlot
(
const FName MappingName, |
Returns the current player key mapping for the given row name in the given slot | UserSettings/EnhancedInputUserSettings.h | |
const UInputAction * FindInputActionForMapping
(
const FName MappingName |
Returns the Input Action associated with the given player mapping name | UserSettings/EnhancedInputUserSettings.h | |
virtual const TSet< FPlayerKeyMapping > & FindMappingsInRow
(
UPARAM(Meta=(GetOptions="EnhancedInput.PlayerMappableKeySettings.GetKnownMappingNames")) const FName... |
Returns a set of all player key mappings for the given mapping name. | UserSettings/EnhancedInputUserSettings.h |
|
UEnhancedPlayerMappableKeyProfile * GetActiveKeyProfile() |
Get the currently active key profile that the user has set | UserSettings/EnhancedInputUserSettings.h |
|
T * GetActiveKeyProfileAs() |
Get the current key profile that the user has set, casted to type T | UserSettings/EnhancedInputUserSettings.h | |
virtual const FString & GetActiveKeyProfileId() |
Gets the currently selected key profile | UserSettings/EnhancedInputUserSettings.h |
|
const TMap< FString, TObjectPtr< UEnhancedPlayerMappableKeyProfile > > & GetAllAvailableKeyProfiles() |
Returns all player saved key profiles | UserSettings/EnhancedInputUserSettings.h | |
const TMap< FGameplayTag, TObjectPtr< UEnhancedPlayerMappableKeyProfile > > & GetAllSavedKeyProfiles() |
Returns all player saved key profiles | UserSettings/EnhancedInputUserSettings.h | |
UEnhancedPlayerMappableKeyProfile * GetCurrentKeyProfile() |
Get the current key profile that the user has set | UserSettings/EnhancedInputUserSettings.h | |
T * GetCurrentKeyProfileAs() |
Get the current key profile that the user has set | UserSettings/EnhancedInputUserSettings.h | |
virtual const FGameplayTag & GetCurrentKeyProfileIdentifier() |
Gets the currently selected key profile | UserSettings/EnhancedInputUserSettings.h | |
| Returns a pointer to the default key profile created by Enhanced Input. | UserSettings/EnhancedInputUserSettings.h | ||
virtual UEnhancedPlayerMappableKeyProfile * GetKeyProfileWithId
(
const FString& ProfileId |
UserSettings/EnhancedInputUserSettings.h |
|
|
T * GetKeyProfileWithIdAs
(
const FString& ProfileId |
Returns the key profile with the given name if one exists. Null if one doesn't exist | UserSettings/EnhancedInputUserSettings.h | |
virtual UEnhancedPlayerMappableKeyProfile * GetKeyProfileWithIdentifier
(
const FGameplayTag& ProfileId |
Returns the key profile with the given name if one exists. Null if one doesn't exist | UserSettings/EnhancedInputUserSettings.h | |
T * GetKeyProfileWithIdentifierAs
(
const FGameplayTag& ProfileId |
Returns the key profile with the given name if one exists. Null if one doesn't exist | UserSettings/EnhancedInputUserSettings.h | |
ULocalPlayer * GetLocalPlayer() |
UserSettings/EnhancedInputUserSettings.h | ||
const TSet< TObjectPtr< const UInputMappingContext > > & GetRegisteredInputMappingContexts() |
Gets all the currently registered mapping contexts with the settings | UserSettings/EnhancedInputUserSettings.h | |
virtual void Initialize
(
ULocalPlayer* LP |
UserSettings/EnhancedInputUserSettings.h | ||
bool IsKeyProfileAvailable
(
const FString& ProfileId |
Returns true if the given ProfileId is currently available in the user settings. | UserSettings/EnhancedInputUserSettings.h | |
bool IsMappingContextRegistered
(
const UInputMappingContext* IMC |
Returns true if this mapping context is currently registered with the settings | UserSettings/EnhancedInputUserSettings.h |
|
virtual void MapPlayerKey
(
const FMapPlayerKeyArgs& InArgs, |
Sets the player mapped key on the current key profile. | UserSettings/EnhancedInputUserSettings.h |
|
virtual bool RegisterInputMappingContext
(
const UInputMappingContext* IMC |
Registers this mapping context with the user settings. | UserSettings/EnhancedInputUserSettings.h |
|
bool RegisterInputMappingContexts
(
const TSet< UInputMappingContext* >& MappingContexts |
Registers multiple mapping contexts with the settings | UserSettings/EnhancedInputUserSettings.h |
|
virtual void ResetAllPlayerKeysInRow
(
const FMapPlayerKeyArgs& InArgs, |
Resets each player mapped key to it's default value from the Input Mapping Context that it was registered from. | UserSettings/EnhancedInputUserSettings.h |
|
virtual void ResetKeyProfileIdToDefault
(
const FString& ProfileId, |
Resets the given key profile to default key mappings | UserSettings/EnhancedInputUserSettings.h |
|
virtual void ResetKeyProfileToDefault
(
const FGameplayTag& ProfileId, |
Resets the given key profile to default key mappings | UserSettings/EnhancedInputUserSettings.h |
|
virtual void SaveSettings () |
Synchronously save the settings to a hardcoded save game slot. | UserSettings/EnhancedInputUserSettings.h |
|
virtual void Serialize
(
FArchive& Ar |
UserSettings/EnhancedInputUserSettings.h | ||
virtual bool SetActiveKeyProfile
(
const FString& InProfileId |
Changes the currently active key profile to the one with the given name. | UserSettings/EnhancedInputUserSettings.h |
|
virtual bool SetKeyProfile
(
const FGameplayTag& InProfileId |
Changes the currently active key profile to the one with the given name. | UserSettings/EnhancedInputUserSettings.h | |
void ShowDebugInfo
(
UCanvas* Canvas |
Draw debug information on the screen for these user settings. | UserSettings/EnhancedInputUserSettings.h | |
virtual void UnMapPlayerKey
(
const FMapPlayerKeyArgs& InArgs, |
Unmaps a single player mapping that matches the given Mapping name, slot, and hardware device. | UserSettings/EnhancedInputUserSettings.h |
|
virtual bool UnregisterInputMappingContext
(
const UInputMappingContext* IMC |
Removes this mapping context from the registered mapping contexts | UserSettings/EnhancedInputUserSettings.h |
|
bool UnregisterInputMappingContexts
(
const TSet< UInputMappingContext* >& MappingContexts |
Removes multiple mapping contexts from the registered mapping contexts | UserSettings/EnhancedInputUserSettings.h |
|
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FHardwareDeviceIdentifier DetermineHardwareDeviceForActionMapping
(
const FEnhancedActionKeyMapping& ActionMapping |
UserSettings/EnhancedInputUserSettings.h | ||
virtual FHardwareDeviceIdentifier DetermineHardwareDeviceForActionMapping
(
const FEnhancedActionKeyMapping& ActionMapping, |
Determines the hardware device that an action key mapping is associated with. | UserSettings/EnhancedInputUserSettings.h | |
virtual void HandleSettingsClassChangedOnLoad_Impl
(
UEnhancedInputUserSettings* OldSettingsObject |
Override this function to be notified of when the user settings class has changed. | UserSettings/EnhancedInputUserSettings.h | |
virtual void OnAsyncSaveComplete
(
const FString& SlotName, |
UserSettings/EnhancedInputUserSettings.h | ||
virtual void OnKeyMappingRegistered
(
FPlayerKeyMapping& RegisteredMapping, |
A virtual function that will be called whenever a player key mapping is first registered. | UserSettings/EnhancedInputUserSettings.h | |
virtual void OnKeyMappingRegisteredToProfile
(
UEnhancedPlayerMappableKeyProfile* Profile, |
A virtual function that will be called whenever a player key mapping is first registered. | UserSettings/EnhancedInputUserSettings.h | |
virtual void OnKeyMappingUpdated
(
FPlayerKeyMapping* ChangedMapping, |
A virtual function that will be called whenever a player key mapping has been updated, before OnSettingsChanged is called. | UserSettings/EnhancedInputUserSettings.h | |
bool RegisterInputMappingContextInternal
(
const UInputMappingContext* IMC |
This will register the given IMC to the settings system. | UserSettings/EnhancedInputUserSettings.h | |
virtual bool RegisterKeyMappingsToProfile
(
UEnhancedPlayerMappableKeyProfile& Profile, |
This will register individual key mappings from the given Input Mapping context on the profile id. | UserSettings/EnhancedInputUserSettings.h | |
virtual void ShowDebugInfoInternal
(
UCanvas* Canvas |
Provides a space for subclasses to add additional debug info if desired. | UserSettings/EnhancedInputUserSettings.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FString GetSaveFilename
(
const ULocalPlayer* LP |
Returns the save file name to use when saving the settings file for the given local player | UserSettings/EnhancedInputUserSettings.h | |
static UEnhancedInputUserSettings * LoadOrCreateSettings
(
ULocalPlayer* LP |
Loads or creates new user settings for the owning local player of the given player input | UserSettings/EnhancedInputUserSettings.h |