Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
A generic structure for targeting data. We want generic functions to produce this data and other generic functions to consume this data.
We expect this to be able to hold specific actors/object reference and also generic location/direction/origin information.
Some example producers: -Overlap/Hit collision event generates TargetData about who was hit in a melee attack -A mouse input causes a hit trace and the actor infront of the crosshair is turned into TargetData -A mouse input causes TargetData to be generated from the owner's crosshair view origin/direction -An AOE/aura pulses and all actors in a radius around the instigator are added to TargetData -Panzer Dragoon style 'painting' targeting mode -MMORPG style ground AOE targeting style (potentially both a location on the ground and actors that were targeted)
Some example consumers: -Apply a GameplayEffect to all actors in TargetData -Find closest actor from all in TargetData -Call some function on all actors in TargetData -Filter or merge TargetDatas -Spawn a new actor at a TargetData location
Maybe it is better to distinguish between actor list targeting vs positional targeting data? -AOE/aura type of targeting data blurs the line
| Name | FGameplayAbilityTargetData |
| Type | struct |
| Header File | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/Abilities/GameplayAbilityTargetTypes.h |
| Include Path | #include "Abilities/GameplayAbilityTargetTypes.h" |
Syntax
USTRUCT ()
struct FGameplayAbilityTargetData
Derived Classes
- FGameplayAbilityTargetData_ActorArray
- FGameplayAbilityTargetData_LocationInfo
- FGameplayAbilityTargetData_SingleTargetHit
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FGameplayAbilityTargetData() |
Abilities/GameplayAbilityTargetTypes.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddTargetDataToContext
(
FGameplayEffectContextHandle& Context, |
Modifies the context and adds this target data to the target data handle stored within | Abilities/GameplayAbilityTargetTypes.h | |
TArray< FActiveGameplayEffectHandle > ApplyGameplayEffect
(
const UGameplayEffect* GameplayEffect, |
Applies a gameplay effect to each target represented | Abilities/GameplayAbilityTargetTypes.h | |
virtual TArray< FActiveGameplayEffectHandle > ApplyGameplayEffectSpec
(
FGameplayEffectSpec& Spec, |
Applies a previously created gameplay effect spec to each target represented | Abilities/GameplayAbilityTargetTypes.h | |
virtual TArray< TWeakObjectPtr< AActor > > GetActors() |
Returns all actors targeted, almost always overridden | Abilities/GameplayAbilityTargetTypes.h | |
virtual FVector GetEndPoint() |
Override to return a target/end point | Abilities/GameplayAbilityTargetTypes.h | |
virtual FTransform GetEndPointTransform() |
Override to return a transform, default will create one from just the location | Abilities/GameplayAbilityTargetTypes.h | |
virtual const FHitResult * GetHitResult() |
Override to return a hit result | Abilities/GameplayAbilityTargetTypes.h | |
virtual FTransform GetOrigin() |
Override to return an origin point, which may be derived from other data | Abilities/GameplayAbilityTargetTypes.h | |
virtual UScriptStruct * GetScriptStruct() |
Returns the serialization data, must always be overridden | Abilities/GameplayAbilityTargetTypes.h | |
virtual bool HasEndPoint() |
Override to true if GetEndPoint/Transform will work | Abilities/GameplayAbilityTargetTypes.h | |
virtual bool HasHitResult() |
Return true in subclasses if GetHitResult will work | Abilities/GameplayAbilityTargetTypes.h | |
virtual bool HasOrigin() |
Override to true if GetOrigin will work | Abilities/GameplayAbilityTargetTypes.h | |
virtual void ReplaceHitWith
(
AActor* NewHitActor, |
Abilities/GameplayAbilityTargetTypes.h | ||
virtual bool SetActors
(
TArray< TWeakObjectPtr< AActor > > NewActorArray |
Modify the actor list | Abilities/GameplayAbilityTargetTypes.h | |
virtual bool ShouldCheckForTargetActorSwap() |
See notes on delegate definition FOnTargetActorSwapped | Abilities/GameplayAbilityTargetTypes.h | |
virtual FString ToString() |
Returns a debug string representation | Abilities/GameplayAbilityTargetTypes.h |