FGameplayAbilityTargetData

A generic structure for targeting data.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

GameplayAbilities

Header

/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/Abilities/GameplayAbilityTargetTypes.h

Include

#include "Abilities/GameplayAbilityTargetTypes.h"

Syntax

[USTRUCT](Programming/UnrealArchitecture/Reference/Structs)()
struct FGameplayAbilityTargetData

Remarks

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

Destructors

Functions

Name Description

Public function Virtual Const

void

 

AddTargetDataToContext

(
    FGameplayEffectContextHandle& Cont...,
    bool bIncludeActorArray
)

Modifies the context and adds this target data to the target data handle stored within

Public function Virtual Const

void

 

AddTargetDataToGameplayCueParameters

(
    FGameplayCueParameters& Parameters
)

Modifies the cue parameters and adds this target data to the target data handle stored within

Public function

TArray< FAct...

 

ApplyGameplayEffect

(
    const UGameplayEffect* Gamepla...,
    const FGameplayEffectContextHandle ...,
    float Level,
    FPredictionKey PredictionKey
)

Applies a gameplay effect to each target represented

Public function Virtual

TArray< FAct...

 

ApplyGameplayEffectSpec

(
    FGameplayEffectSpec& Spec,
    FPredictionKey PredictionKey
)

Applies a previously created gameplay effect spec to each target represented

Public function Virtual Const

TArray< TWea...

 

GetActors()

Returns all actors targeted, almost always overridden

Public function Virtual Const

FVector

 

GetEndPoint()

Override to return a target/end point

Public function Virtual Const

FTransform

 

GetEndPointTransform()

Override to return a transform, default will create one from just the location

Public function Virtual Const

const FHitRe...

 

GetHitResult()

Override to return a hit result

Public function Virtual Const

FTransform

 

GetOrigin()

Override to return an origin point, which may be derived from other data

Public function Virtual Const

UScriptStruc...

 

GetScriptStruct()

Returns the serialization data, must always be overridden

Public function Virtual Const

bool

 

HasEndPoint()

Override to true if GetEndPoint/Transform will work

Public function Virtual Const

bool

 

HasHitResult()

Return true in subclasses if GetHitResult will work

Public function Virtual Const

bool

 

HasOrigin()

Override to true if GetOrigin will work

Public function Virtual

void

 

ReplaceHitWith

(
    AActor* NewHitActor,
    const FHitResult* NewHitResult
)

Public function Virtual

bool

 

SetActors

(
    TArray< TWeakObjectPtr< AActor >> N...
)

Modify the actor list

Public function Virtual Const

bool

 

ShouldCheckForTargetActorSwap()

See notes on delegate definition FOnTargetActorSwapped

Public function Virtual Const

FString

 

ToString()

Returns a debug string representation

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss