Navigation
API > API/Plugins > API/Plugins/TargetingSystem
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.
| Name | UTargetingSubsystem |
| Type | class |
| Header File | /Engine/Plugins/Experimental/GameplayTargetingSystem/Source/GameplayTargetingSystem/Public/TargetingSystem/TargetingSubsystem.h |
| Include Path | #include "TargetingSystem/TargetingSubsystem.h" |
Syntax
UCLASS (MinimalAPI, DisplayName="Targeting Subsystem")
class UTargetingSubsystem :
public UGameInstanceSubsystem ,
public FTickableGameObject ,
public FSelfRegisteringExec
Inheritance Hierarchy
- FExec → FSelfRegisteringExec → UTargetingSubsystem
- FTickableObjectBase → FTickableGameObject → UTargetingSubsystem
- UObjectBase → UObjectBaseUtility → UObject → USubsystem → UGameInstanceSubsystem → UTargetingSubsystem
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UTargetingSubsystem() |
TargetingSystem/TargetingSubsystem.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FOnTargetingRequestHandleReleased | TMulticastDelegate_OneParam< void, FTargetingRequestHandle > | The handle released delegate that fires right before a handle is release so all data stores can clean up their state | TargetingSystem/TargetingSubsystem.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AsyncTargetingRequests | TArray< FTargetingRequestHandle > | The set of target requests queued up for async processing | TargetingSystem/TargetingSubsystem.h |
|
| bTickingAsycnRequests | bool | Flag indicating the targeting system is currently in its tick processing targeting tasks for async request | TargetingSystem/TargetingSubsystem.h | |
| CurrentAsyncRequestIndex | int32 | TargetingSystem/TargetingSubsystem.h | ||
| CurrentImmediateRequestIndex | int32 | TargetingSystem/TargetingSubsystem.h | ||
| DebugTrackedAsyncTargetRequests | TArray< FTargetingRequestHandle > | TargetingSystem/TargetingSubsystem.h | ||
| DebugTrackedImmediateTargetRequests | TArray< FTargetingRequestHandle > | TargetingSystem/TargetingSubsystem.h | ||
| PendingAsyncTargetingRequests | TSortedMap< FTargetingRequestHandle, FTargetingRequestData > | (Version for Async Requests) While we're processing targeting requests, we add any incoming requests to this array to prevent memory stomps | TargetingSystem/TargetingSubsystem.h | |
| PendingTargetingRequests | TSortedMap< FTargetingRequestHandle, FTargetingRequestData > | While we're processing targeting requests, we add any incoming requests to this array to prevent memory stomps | TargetingSystem/TargetingSubsystem.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void DebugLine
(
FTargetingDebugInfo& Info, |
Helper methd to write a debug line when the ShowDebug TargetingSystem is active | TargetingSystem/TargetingSubsystem.h | |
void ExecuteTargetingRequest
(
const UTargetingPreset* TargetingPreset, |
Method to execute an immediate targeting request based on a gameplay targeting preset. | TargetingSystem/TargetingSubsystem.h |
|
void ExecuteTargetingRequestWithHandle
(
FTargetingRequestHandle TargetingHandle, |
Target Handle Generation Methods Targeting Request Methods Method to execute an immediate targeting request with a given targeting handle. | TargetingSystem/TargetingSubsystem.h | |
void GetTargetingResults
(
FTargetingRequestHandle TargetingHandle, |
Helper method to get the set of hit results for a given targeting handle | TargetingSystem/TargetingSubsystem.h |
|
void GetTargetingResultsActors
(
FTargetingRequestHandle TargetingHandle, |
Method to get the actor targets from a given targeting request handle | TargetingSystem/TargetingSubsystem.h |
|
FTargetingSourceContext GetTargetingSourceContext
(
FTargetingRequestHandle TargetingHandle |
~Targeting Request Methods Blueprint Helper Methods Returns the targeting source context for the targeting request handle | TargetingSystem/TargetingSubsystem.h |
|
void RemoveAsyncTargetingRequestWithHandle
(
FTargetingRequestHandle& TargetingHandle |
Method to remove an async targeting request with a given targeting handle | TargetingSystem/TargetingSubsystem.h |
|
FTargetingRequestHandle StartAsyncTargetingRequest
(
const UTargetingPreset* TargetingPreset, |
Method to queue an async targeting request based on a gameplay targeting preset. | TargetingSystem/TargetingSubsystem.h |
|
void StartAsyncTargetingRequestWithHandle
(
FTargetingRequestHandle TargetingHandle, |
Method to queue an async targeting request with a given targeting handle. | TargetingSystem/TargetingSubsystem.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void AddReferencedObjects
(
UObject* InThis, |
Implemented to emit references from the global data stores | TargetingSystem/TargetingSubsystem.h | |
static FTargetingRequestHandle CreateTargetRequestHandle() |
Target Handle Generation Methods Method to create a basic target request handle (nothing will be setup for any targeting requests) The request data store, task set data store, and source context data store will have to be setup manually by caller. | TargetingSystem/TargetingSubsystem.h | |
static UTargetingSubsystem * Get
(
const UWorld* World |
Method to get the mesh network events subsystem | TargetingSystem/TargetingSubsystem.h | |
static float GetOverrideTargetingLifeTime() |
Helper method to overrides the life time of the shapes drawn | TargetingSystem/TargetingSubsystem.h | |
static UTargetingSubsystem * GetTargetingSubsystem
(
const UObject* WorldContextObject |
TargetingSystem/TargetingSubsystem.h | ||
static bool IsTargetingDebugEnabled() |
~Blueprint Helper Methods Debug Helper Methods Helper method to indicate if the debugging feature is enabled | TargetingSystem/TargetingSubsystem.h | |
static FTargetingRequestHandle MakeTargetRequestHandle
(
const UTargetingPreset* TargetingPreset, |
Method to create and setup a target request handle given a targeting preset and source context | TargetingSystem/TargetingSubsystem.h | |
static void OnShowDebugInfo
(
AHUD* HUD, |
Callback to handle OnShowDebugInfo to check if the TargetingSystem has been enabled | TargetingSystem/TargetingSubsystem.h | |
static void OverrideCollisionQueryTaskData
(
FTargetingRequestHandle TargetingHandle, |
Function that lets you set a data store from a certain Targeting Handle to add some Collision Query Param Overrides | TargetingSystem/TargetingSubsystem.h |
|
static PRAGMA_DISABLE_DEPRECATION_WARNINGSFTargetingRequestHandle::FOnTargetingRequestHandleReleased & ReleaseHandleDelegate() |
TargetingSystem/TargetingSubsystem.h | ||
static void ReleaseTargetRequestHandle
(
FTargetingRequestHandle& Handle |
Method to release a target handle (Note: Unless flagged via AsyncTaskData or ImmediateTaskData this will not release implicitly) | TargetingSystem/TargetingSubsystem.h |