FGameplayEffectContext

Data structure that stores an instigator and related data, such as positions and targets Games can subclass this structure and add game-specific information It is passed throughout effect execution so it is a great place to track transient information about an execution

Windows
MacOS
Linux

References

Module

GameplayAbilities

Header

/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffectTypes.h

Include

#include "GameplayEffectTypes.h"

Syntax

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

Remarks

Data structure that stores an instigator and related data, such as positions and targets Games can subclass this structure and add game-specific information It is passed throughout effect execution so it is a great place to track transient information about an execution

Variables

Name Description

Protected variable UProperty

TWeakObjectPtr<...

 

AbilityCDO

The ability CDO that is responsible for this effect context (replicated)

Protected variable UProperty notreplicated

TWeakObjectPtr<...

 

AbilityInstanceNotReplicated

The ability instance that is responsible for this effect context (NOT replicated)

Protected variable UProperty

int32

 

AbilityLevel

The level this was executed at

Protected variable UProperty

TArray< TWeakOb...

 

Actors

Actors referenced by this context

Protected variable UProperty

uint8: 1

 

bHasWorldOrigin

Protected variable UProperty

uint8: 1

 

bReplicateSourceObject

True if the SourceObject can be replicated. This bool is not replicated itself.

Protected variable UProperty

TWeakObjectPtr<...

 

EffectCauser

The physical actor that actually did the damage, can be a weapon or projectile

Protected variable

TSharedPtr< FHi...

 

HitResult

Trace information - may be nullptr in many cases

Protected variable UProperty

TWeakObjectPtr<...

 

Instigator

Instigator actor, the actor that owns the ability system component

Protected variable UProperty notreplicated

TWeakObjectPtr<...

 

InstigatorAbilitySystemComponent

The ability system component that's bound to instigator

Protected variable UProperty

TWeakObjectPtr<...

 

SourceObject

Object this effect was created from, can be an actor or static object.

Protected variable UProperty

FVector

 

WorldOrigin

Stored origin, may be invalid if bHasWorldOrigin is false

Constructors

Name Description

Public function

FGameplayEffectContext()

Public function

FGameplayEffectContext

(
    AActor* InInstigator,
    AActor* InEffectCauser
)

Destructors

Name Description

Public function Virtual

~FGameplayEffectContext()

Functions

Name Description

Public function Virtual

void

 

AddActors

(
    const TArray< TWeakObjectPtr< AActo...,
    bool bReset
)

Add actors to the stored actor list

Public function Virtual

void

 

AddHitResult

(
    const FHitResult& InHitResult,
    bool bReset
)

Add a hit result for targeting

Public function Virtual

void

 

AddInstigator

(
    AActor* InInstigator,
    AActor* InEffectCauser
)

Sets the instigator and effect causer.

Public function Virtual

void

 

AddOrigin

(
    FVector InOrigin
)

Adds an origin point

Public function Virtual

void

 

AddSourceObject

(
    const UObject* NewSourceObject
)

Sets the object this effect was created from.

Public function Virtual Const

FGameplayEff...

 

Duplicate()

Creates a copy of this context, used to duplicate for later modifications

Public function Const

const UGamep...

 

GetAbility()

Returns the CDO of the ability used to instigate this context

Public function Const

const UGamep...

 

GetAbilityInstance_NotReplicated()

Returns the specific instance that instigated this, may not always be set

Public function Const

int32

 

GetAbilityLevel()

Gets the ability level this was evaluated at

Public function Virtual Const

const TArray...

 

GetActors()

Returns actor list, may be empty

Public function Virtual Const

AActor *

 

GetEffectCauser()

Returns the physical actor tied to the application of this effect

Public function Virtual Const

const FHitRe...

 

GetHitResult()

Returns hit result, this can be null

Public function Virtual

FHitResult &...

 

GetHitResult()

Returns hit result, this can be null

Public function Virtual Const

AActor *

 

GetInstigator()

Returns the immediate instigator that applied this effect

Public function Virtual Const

UAbilitySyst...

 

GetInstigatorAbilitySystemComponent()

Returns the ability system component of the instigator of this effect

Public function Virtual Const

const FVecto...

 

GetOrigin()

Returns origin point, may be invalid if HasOrigin is false

Public function Virtual Const

AActor *

 

GetOriginalInstigator()

Should always return the original instigator that started the whole chain.

Public function Virtual Const

UAbilitySyst...

 

GetOriginalInstigatorAbilitySystemComponent()

Returns the ability system component of the instigator that started the whole chain

Public function Virtual Const

void

 

GetOwnedGameplayTags

(
    OUTFGameplayTagContainer& ActorTag...,
    OUTFGameplayTagContainer& SpecTagC...
)

Returns the list of gameplay tags applicable to this effect, defaults to the owner's tags

Public function Virtual Const

UScriptStruc...

 

GetScriptStruct()

Returns the actual struct used for serialization, subclasses must override this!

Public function Virtual Const

UObject *...

 

GetSourceObject()

Returns the object this effect was created from.

Public function Virtual Const

bool

 

HasOrigin()

Returns true if GetOrigin will give valid information

Public function Virtual Const

bool

 

IsLocallyControlled()

True if this was instigated by a locally controlled actor

Public function Virtual Const

bool

 

IsLocallyControlledPlayer()

True if this was instigated by a locally controlled player

Public function Virtual

bool

 

NetSerialize

(
    FArchive& Ar,
    UPackageMap* Map,
    bool& bOutSuccess
)

Custom serialization, subclasses must override this

Public function Virtual

void

 

SetAbility

(
    const UGameplayAbility* InGame...
)

Sets the ability that was used to spawn this

Public function

void

 

SetEffectCauser

(
    AActor* InEffectCauser
)

Modify the effect causer actor, useful when that information is added after creation

Public function Virtual Const

FString

 

ToString()

Returns debug string

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