unreal.InputMappingContext

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

Bases: DataAsset

UInputMappingContext : A collection of key to action mappings for a specific input context Could be used to:

Store predefined controller mappings (allow switching between controller config variants). TODO: Build a system allowing redirects of UInputMappingContexts to handle this. Define per-vehicle control mappings Define context specific mappings (e.g. I switch from a gun (shoot action) to a grappling hook (reel in, reel out, disconnect actions). Define overlay mappings to be applied on top of existing control mappings (e.g. Hero specific action mappings in a MOBA)

C++ Source:

  • Plugin: EnhancedInput

  • Module: EnhancedInput

  • File: InputMappingContext.h

Editor Properties: (see get_editor_property/set_editor_property)

  • context_description (Text): [Read-Write] Localized context descriptor

  • default_key_mappings (InputMappingContextMappingData): [Read-Write] List of Input Actions to which FKeys they are mapped to.

  • input_mode_filter_options (MappingContextInputModeFilterOptions): [Read-Write] Defines how this input mapping context should be filtered based on the current input mode.

    Default is Use Project Default Query. Note:: bEnableInputModeFiltering must be enabled in the UEnhancedInputDeveloperSettings for this to be considered.

  • input_mode_query_override (GameplayTagQuery): [Read-Write] Tag Query which will be matched against the current Enhanced Input Subsystem’s input mode if InputModeFilterOptions is set to UseCustomQuery.

    If this tag query does not match with the current input mode tag container, then the mappings will not be processed. Note:: bEnableInputModeFiltering must be enabled in the UEnhancedInputDeveloperSettings for this to be considered.

  • mapping_profile_overrides (Map[str, InputMappingContextMappingData]): [Read-Write] Key mappings that should be used INSTEAD of the default “Mappings” array above then the provided Remappable Key Profile of the given name is currently active.

    If there are no override mappings specified for a set for a specific mapping profile, then the default mappings will be used.

  • mappings (Array[EnhancedActionKeyMapping]): [Read-Write] deprecated: Use the DefaultKeyMappings struct instead.

  • registration_tracking_mode (MappingContextRegistrationTrackingMode): [Read-Write] Select the behaviour when multiple AddMappingContext() calls are made for this Input Mapping Context

property context_description: Text

[Read-Only] Localized context descriptor

Type:

(Text)

property default_key_mappings: InputMappingContextMappingData

[Read-Only] List of Input Actions to which FKeys they are mapped to.

Type:

(InputMappingContextMappingData)

property input_mode_filter_options: MappingContextInputModeFilterOptions

[Read-Only] Defines how this input mapping context should be filtered based on the current input mode.

Default is Use Project Default Query. Note:: bEnableInputModeFiltering must be enabled in the UEnhancedInputDeveloperSettings for this to be considered.

Type:

(MappingContextInputModeFilterOptions)

property input_mode_query_override: GameplayTagQuery

[Read-Only] Tag Query which will be matched against the current Enhanced Input Subsystem’s input mode if InputModeFilterOptions is set to UseCustomQuery.

If this tag query does not match with the current input mode tag container, then the mappings will not be processed. Note:: bEnableInputModeFiltering must be enabled in the UEnhancedInputDeveloperSettings for this to be considered.

Type:

(GameplayTagQuery)

map_key(action, to_key) EnhancedActionKeyMapping

Map a key to an action within the mapping context.

Parameters:
Return type:

EnhancedActionKeyMapping

property mapping_profile_overrides: None

[Read-Only] Key mappings that should be used INSTEAD of the default “Mappings” array above then the provided Remappable Key Profile of the given name is currently active.

If there are no override mappings specified for a set for a specific mapping profile, then the default mappings will be used.

Type:

(Map[str, InputMappingContextMappingData])

property mappings: None

[Read-Only] deprecated: Use the DefaultKeyMappings struct instead.

Type:

(Array[EnhancedActionKeyMapping])

property registration_tracking_mode: MappingContextRegistrationTrackingMode

[Read-Only] Select the behaviour when multiple AddMappingContext() calls are made for this Input Mapping Context

Type:

(MappingContextRegistrationTrackingMode)

unmap_all() None

Unmap everything within the mapping context.

unmap_all_keys_from_action(action) None

Unmap all key maps to an action within the mapping context.

Parameters:

action (InputAction)

unmap_key(action, key) None

Unmap a key from an action within the mapping context.

Parameters: