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, 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_tag_to_input_mode(tag_to_add, options=[True, False, False]) None

Adds the given “TagToAdd” to the current input mode tag container and triggers a rebuild of control mappings.

Parameters:
  • tag_to_add (GameplayTag) – The gameplay tag to add to the current input mode tag container

  • options (ModifyContextOptions) – Options for how to treat the control mappings rebuild

append_tags_to_input_mode(tags_to_add, options=[True, False, False]) None

Appends the given “TagsToAdd” to the current input mode tag container and triggers a rebuild of control mappings.

Parameters:
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_input_mode() GameplayTagContainer

Returns the current input mode set on Enhanced Input. This mode will control what mappings are currently being processed by the player. If the Input Mapping Context’s InputModeQuery is not empty and does not match this tag container, then it’s mappings will not be processed.

Return type:

GameplayTagContainer

get_user_settings() EnhancedInputUserSettings

Get User Settings

Return type:

EnhancedInputUserSettings

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_for_player_mapping(mapping_name, 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:
  • mapping_name (Name) – The name of the player mapping that can be used for look up an associated UInputAction object.

  • raw_value (InputActionValue) – The value to set the action to

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

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

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.

inject_input_vector_for_player_mapping(mapping_name, 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:
  • mapping_name (Name) – The name of the player mapping that can be used for look up an associated UInputAction object.

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

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_mapping_context(mapping_context, options=[True, False, False]) None

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

Parameters:
remove_tag_from_input_mode(tag_to_remove, options=[True, False, False]) None

Removes the given tag from the current input mode and triggers a rebuild of control mappings.

Parameters:
  • tag_to_remove (GameplayTag) – The tag to remove from the current input mode

  • options (ModifyContextOptions) – Options for how to treat the control mappings rebuild

remove_tags_from_input_mode(tags_to_remove, options=[True, False, False]) None

Removes tags from the current input mode and triggers a rebuild of control mappings.

Parameters:
request_rebuild_control_mappings(options=[True, False, 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:
set_input_mode(new_mode, options=[True, False, False]) None

Sets the current input mode on the player and triggers a rebuild of control mappings.

Parameters:
start_continuous_input_injection_for_action(action, raw_value, modifiers, triggers) None

Starts simulation of input via injection. This injects the given input every tick until it is stopped with StopContinuousInputInjectionForAction.

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

  • raw_value (InputActionValue) – 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.

start_continuous_input_injection_for_player_mapping(mapping_name, raw_value, modifiers, triggers) None

Starts simulation of input via injection. This injects the given input every tick until it is stopped with StopContinuousInputInjectionForAction.

Parameters:
  • mapping_name (Name) – The name of the player mapping that can be used for look up an associated UInputAction object.

  • raw_value (InputActionValue) – 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.

stop_continuous_input_injection_for_action(action) None

Stops continuous input injection for the given action.

Parameters:

action (InputAction) – The action to stop injecting input for

stop_continuous_input_injection_for_player_mapping(mapping_name) None

Stops continuous input injection for the given player mapping name.

Parameters:

mapping_name (Name) – The name of the player mapping that can be used for look up an associated UInputAction object.

update_value_of_continuous_input_injection_for_action(action, raw_value) None

Update the value of a continuous input injection, preserving the state of triggers and modifiers.

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

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

update_value_of_continuous_input_injection_for_player_mapping(mapping_name, raw_value) None

Update the value of a continuous input injection for the given player mapping name, preserving the state of triggers and modifiers.

Parameters:
  • mapping_name (Name) – The name of the player mapping that can be used for look up an associated UInputAction object.

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