unreal.EnhancedInputWorldSubsystem

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

Bases: WorldSubsystem

Per world input subsystem that allows you to bind input delegates to actors without an owning Player Controller. This should be used when an actor needs to receive input delegates but will never have an owning Player Controller. For example, you can add input delegates to unlock a door when the user has a certain set of keys pressed. Be sure to enable input on the actor, or else the input delegates won’t fire!

Note: if you do have an actor with an owning Player Controller use the local player input subsystem instead.

C++ Source:

  • Plugin: EnhancedInput

  • Module: EnhancedInput

  • File: EnhancedInputSubsystems.h

add_actor_input_component(actor) None

Adds this Actor’s input component onto the stack to be processed by this subsystem’s tick function

Parameters:

actor (Actor) –

add_mapping_context(mapping_context, priority, options=[True, False]) None

Add a control mapping context.

Parameters:
  • mapping_context (InputMappingContext) – A set of key to action mappings to apply to this player

  • priority (int32) – Higher priority mappings will be applied first and, if they consume input, will block lower priority mappings.

  • options (ModifyContextOptions) – Options to consider when adding this mapping context.

add_player_mappable_config(config, options=[True, False]) None

Adds all the input mapping contexts inside of this mappable config.

Parameters:
add_player_mapped_key(mapping_name: Name, new_key: Key, key_slot: PlayerMappableKeySlot = Ellipsis, options: ModifyContextOptions = Ellipsis) int

deprecated: ‘add_player_mapped_key’ was renamed to ‘k2_add_player_mapped_key_in_slot’.

clear_all_mappings() None

Remove all applied mapping contexts.

get_all_player_mappable_action_key_mappings() Array[EnhancedActionKeyMapping]

Get an array of the currently applied key mappings that are marked as Player Mappable.

Return type:

Array[EnhancedActionKeyMapping]

get_all_player_mapped_keys(mapping_name) Array[Key]

Get all the player mapped keys to the given mapping name. If there is not a player mapped key, then this will return TArray<FKey>().

Parameters:

mapping_name (Name) – The FName of the mapped key that would have been set with the AddPlayerMappedKey function.

Return type:

Array[Key]

get_player_mapped_key(mapping_name: Name, key_slot: PlayerMappableKeySlot = Ellipsis) Key

deprecated: ‘get_player_mapped_key’ was renamed to ‘k2_get_player_mapped_key_in_slot’.

has_mapping_context(mapping_context) int32 or None

Check if a mapping context is applied to this subsystem’s owner.

Parameters:

mapping_context (InputMappingContext) – The mapping context to search for on the subsystem’s owner.

Returns:

True if the mapping context is applied

out_found_priority (int32): The priority of the mapping context if it is applied. -1 if the context is not applied

Return type:

int32 or None

inject_input_for_action(action, raw_value, modifiers, triggers) None

Input simulation via injection. Runs modifiers and triggers delegates as if the input had come through the underlying input system as FKeys. Applies action modifiers and triggers on top.

Parameters:
inject_input_vector_for_action(action, value, modifiers, triggers) None

Input simulation via injection. Runs modifiers and triggers delegates as if the input had come through the underlying input system as FKeys. Applies action modifiers and triggers on top.

Parameters:
  • action (InputAction) – The Input Action to set inject input for

  • value (Vector) – The value to set the action to (the type will be controlled by the Action)

  • modifiers (Array[InputModifier]) – The modifiers to apply to the injected input.

  • triggers (Array[InputTrigger]) – The triggers to apply to the injected input.

k2_add_player_mapped_key_in_slot(mapping_name, new_key, key_slot=[0], options=[True, False]) int32

Emplace or replace any currently applied key in KeySlot for mapping of MappingName. Requests a rebuild of the player mappings.

Parameters:
Returns:

The number of mappings that have been replaced

Return type:

int32

k2_get_player_mapped_key_in_slot(mapping_name, key_slot=[0]) Key

Get the player mapped key in first slot to the given mapping name. If there is not a player mapped key, then this will return EKeys::Invalid.

Parameters:
  • mapping_name (Name) – The FName of the mapped key that would have been set with the AddPlayerMappedKey function.

  • key_slot (PlayerMappableKeySlot) –

Return type:

Key

k2_remove_player_mapped_key_in_slot(mapping_name, key_slot=[0], options=[True, False]) int32

Removes player mapped key in the KeySlot for mapping of MappingName. Requests a rebuild of the player mappings.

Parameters:
Returns:

The number of mappings that have been removed

Return type:

int32

query_keys_mapped_to_action(action) Array[Key]

Returns the keys mapped to the given action in the active input mapping contexts.

Parameters:

action (InputAction) –

Return type:

Array[Key]

query_map_key_in_active_context_set(input_context, action, key, blocking_issues) -> (MappingQueryResult, out_issues=Array[MappingQueryIssue])

= DefaultMappingIssues::StandardFatal

Parameters:
Returns:

out_issues (Array[MappingQueryIssue]):

Return type:

Array[MappingQueryIssue]

query_map_key_in_context_set(prioritized_active_contexts, input_context, action, key, blocking_issues) -> (MappingQueryResult, out_issues=Array[MappingQueryIssue])

= DefaultMappingIssues::StandardFatal

Parameters:
Returns:

out_issues (Array[MappingQueryIssue]):

Return type:

Array[MappingQueryIssue]

remove_actor_input_component(actor) bool

Removes this Actor’s input component from the stack to be processed by this subsystem’s tick function

Parameters:

actor (Actor) –

Return type:

bool

remove_all_player_mapped_keys(options=[True, False]) None

Remove All PlayerMappedKeys Requests a rebuild of the player mappings.

Parameters:

options (ModifyContextOptions) –

remove_all_player_mapped_keys_for_mapping(mapping_name, options=[True, False]) int32

Removes all player mapped keys for mapping of MappingName. Requests a rebuild of the player mappings.

Parameters:
Returns:

The number of mappings that have been removed

Return type:

int32

remove_mapping_context(mapping_context, options=[True, False]) None

Remove a specific control context. This is safe to call even if the context is not applied.

Parameters:
remove_player_mappable_config(config, options=[True, False]) None

Removes all the input mapping contexts inside of this mappable config.

Parameters:
remove_player_mapped_key(mapping_name: Name, key_slot: PlayerMappableKeySlot = Ellipsis, options: ModifyContextOptions = Ellipsis) int

deprecated: ‘remove_player_mapped_key’ was renamed to ‘k2_remove_player_mapped_key_in_slot’.

request_rebuild_control_mappings(options=[True, False], rebuild_type=InputMappingRebuildType.REBUILD) None

Flag player for reapplication of all mapping contexts at the end of this frame. This is called automatically when adding or removing mappings contexts.

Parameters: