unreal.TargetingSubsystem

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

Bases: GameInstanceSubsystem

class: UTargetingSubsystem The Targeting Subsystem is the entry point for users to initiate targeting requests. The entry point to the system is the target request handle. The handle is used to interface with the targeting data stores. Data stores are templated classes around generic data structs that the system and tasks use to accomplish a targeting request. The targeting system has 3 mandatory data stores and 1 required for async targeting request. These data stores are required to be set up before the system can properly run a targeting request. The mandatory 3 data stores are FTargetingRequestData, FTargetingTaskSet, and FTargetingSourceContext. FTargetingAsyncTaskData is implicitly setup when an async targeting request is initiated. Users can do all the pieces manually in C++ by setting up the required data stores themselves, or, to have it a bit more automated, the user can use the APIs that utilize UTargetingPreset data asset. For immediate targeting requests users will call the Execute methods. These functions perform all the tasks till completion. The system will not go latent. For async targeting requests users will call the Start Async methods. The system will queue up a targeting request and as each task is processed the system can run through all the tasks to completion or stop processing until the next frame while it waits for a task to complete. Note about Targeting Handles, when a targeting handle is created it will not implicitly release the handle. It is up to the creator to either grab a Async Task Data or Immediate Task Data and set a flag indicating the system should do it for them after the callback fires, or it is up to the user to release the handle when they are done with it.

C++ Source:

  • Plugin: TargetingSystem

  • Module: TargetingSystem

  • File: TargetingSubsystem.h

execute_targeting_request(targeting_preset, source_context, completion_dynamic_delegate) None

Method to execute an immediate targeting request based on a gameplay targeting preset.

Parameters:
get_targeting_results(targeting_handle) Array[HitResult]

Helper method to get the set of hit results for a given targeting handle

Parameters:

targeting_handle (TargetingRequestHandle) –

Returns:

out_targets (Array[HitResult]):

Return type:

Array[HitResult]

get_targeting_results_actors(targeting_handle) Array[Actor]

Method to get the actor targets from a given targeting request handle

Parameters:

targeting_handle (TargetingRequestHandle) –

Returns:

targets (Array[Actor]):

Return type:

Array[Actor]

get_targeting_source_context(targeting_handle) TargetingSourceContext

Returns the targeting source context for the targeting request handle

Parameters:

targeting_handle (TargetingRequestHandle) –

Return type:

TargetingSourceContext

classmethod override_collision_query_task_data(targeting_handle, collision_query_data_override) None

Function that lets you set a data store from a certain Targeting Handle to add some Collision Query Param Overrides

Parameters:
remove_async_targeting_request_with_handle(targeting_handle) TargetingRequestHandle

Method to remove an async targeting request with a given targeting handle

Parameters:

targeting_handle (TargetingRequestHandle) –

Returns:

targeting_handle (TargetingRequestHandle):

Return type:

TargetingRequestHandle

start_async_targeting_request(targeting_preset, source_context, completion_dynamic_delegate) TargetingRequestHandle

Method to queue an async targeting request based on a gameplay targeting preset.

Parameters:
Return type:

TargetingRequestHandle