unreal.EnhancedInputUserSettings

class unreal.EnhancedInputUserSettings(outer: Object | None = None, name: Name | str = 'None')

Bases: SaveGame

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.

C++ Source:

  • Plugin: EnhancedInput

  • Module: EnhancedInput

  • File: EnhancedInputUserSettings.h

Editor Properties: (see get_editor_property/set_editor_property)

  • on_settings_applied (EnhancedInputUserSettingsApplied): [Read-Write]

  • on_settings_changed (EnhancedInputUserSettingsChanged): [Read-Write]

apply_settings() None

Apply any custom input settings to your user. By default, this will just broadcast the OnSettingsApplied delegate which is a useful hook to maybe rebuild some UI or do other user facing updates.

async_save_settings() None

Asynchronously save the settings to a hardcoded save game slot. This will work for simple games, but if you need to integrate it into an advanced save system you should Serialize this object out with the rest of your save data.

OnAsyncSaveComplete will be called upon save completion.

create_new_key_profile(args) EnhancedPlayerMappableKeyProfile

Creates a new profile with this name and type.

Parameters:

args (PlayerMappableKeyProfileCreationArgs) –

Return type:

EnhancedPlayerMappableKeyProfile

find_mappings_in_row(mapping_name) Set[PlayerKeyMapping]

Returns a set of all player key mappings for the given mapping name.

Parameters:

mapping_name (Name) –

Return type:

Set[PlayerKeyMapping]

get_current_key_profile() EnhancedPlayerMappableKeyProfile

Get the current key profile that the user has set

Return type:

EnhancedPlayerMappableKeyProfile

get_current_key_profile_identifier() GameplayTag

Gets the currently selected key profile

Return type:

GameplayTag

get_key_profile_with_identifier(profile_id) EnhancedPlayerMappableKeyProfile

Returns the key profile with the given name if one exists. Null if one doesn’t exist

Parameters:

profile_id (GameplayTag) –

Return type:

EnhancedPlayerMappableKeyProfile

is_mapping_context_registered(imc) bool

Returns true if this mapping context is currently registered with the settings

Parameters:

imc (InputMappingContext) –

Return type:

bool

map_player_key(args) GameplayTagContainer

Sets the player mapped key on the current key profile.

Parameters:

args (MapPlayerKeyArgs) –

Returns:

failure_reason (GameplayTagContainer):

Return type:

GameplayTagContainer

property on_settings_applied: EnhancedInputUserSettingsApplied

[Read-Write]

Type:

(EnhancedInputUserSettingsApplied)

property on_settings_changed: EnhancedInputUserSettingsChanged

[Read-Write]

Type:

(EnhancedInputUserSettingsChanged)

register_input_mapping_context(imc) bool

Registers this mapping context with the user settings. This will iterate all the key mappings in the context and create an initial Player Mappable Key for every mapping that is marked as mappable.

Parameters:

imc (InputMappingContext) –

Return type:

bool

register_input_mapping_contexts(mapping_contexts) bool

Registers multiple mapping contexts with the settings

Parameters:

mapping_contexts (Set[InputMappingContext]) –

Return type:

bool

reset_all_player_keys_in_row(args) GameplayTagContainer

Resets each player mapped key to it’s default value from the Input Mapping Context that it was registered from. If a key did not come from an IMC (i.e. it was added additionally by the player) then it will be reset to EKeys::Invalid.

Parameters:

args (MapPlayerKeyArgs) – Arguments that contain the mapping name and profile ID to find the mapping to reset.

Returns:

failure_reason (GameplayTagContainer): Populated with failure reasons if the operation fails.

Return type:

GameplayTagContainer

reset_key_profile_to_default(profile_id) GameplayTagContainer

Resets the given key profile to default key mappings

Parameters:

profile_id (GameplayTag) – The ID of the key profile to reset

Returns:

failure_reason (GameplayTagContainer): Populated with failure reasons if the operation fails.

Return type:

GameplayTagContainer

save_settings() None

Synchronously save the settings to a hardcoded save game slot. This will work for simple games, but if you need to integrate it into an advanced save system you should Serialize this object out with the rest of your save data.

set_key_profile(profile_id) bool

Changes the currently active key profile to the one with the given name. Returns true if the operation was successful.

Parameters:

profile_id (GameplayTag) –

Return type:

bool

un_map_player_key(args) GameplayTagContainer

Unmaps a single player mapping that matches the given Mapping name, slot, and hardware device.

Parameters:

args (MapPlayerKeyArgs) –

Returns:

failure_reason (GameplayTagContainer):

Return type:

GameplayTagContainer

unregister_input_mapping_context(imc) bool

Removes this mapping context from the registered mapping contexts

Parameters:

imc (InputMappingContext) –

Return type:

bool

unregister_input_mapping_contexts(mapping_contexts) bool

Removes multiple mapping contexts from the registered mapping contexts

Parameters:

mapping_contexts (Set[InputMappingContext]) –

Return type:

bool