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

  • 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.

  • mappings (Array[EnhancedActionKeyMapping]): [Read-Write] List of key to action mappings.

  • 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 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 mappings: None

[Read-Only] List of key to action mappings.

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: