Navigation
API > API/Plugins > API/Plugins/GameplayAbilities
References
| Module | GameplayAbilities |
| Header | /Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Public/GameplayEffectTypes.h |
| Include | #include "GameplayEffectTypes.h" |
Syntax
USTRUCT&40;&41;
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
| Type | Name | Description | |
|---|---|---|---|
| TWeakObjectPtr< UGameplayAbility > | AbilityCDO | The ability CDO that is responsible for this effect context (replicated) | |
| TWeakObjectPtr< UGameplayAbility > | AbilityInstanceNotReplicated | The ability instance that is responsible for this effect context (NOT replicated) | |
| int32 | AbilityLevel | The level this was executed at | |
| TArray< TWeakObjectPtr< AActor > > | Actors | Actors referenced by this context | |
| uint8: 1 | bHasWorldOrigin | ||
| uint8: 1 | bReplicateEffectCauser | True if the Instigator can be replicated. This bool is not replicated itself. | |
| uint8: 1 | bReplicateInstigator | True if the Instigator can be replicated. This bool is not replicated itself. | |
| uint8: 1 | bReplicateSourceObject | True if the SourceObject can be replicated. This bool is not replicated itself. | |
| TWeakObjectPtr< AActor > | EffectCauser | The physical actor that actually did the damage, can be a weapon or projectile | |
| TSharedPtr< FHitResult > | HitResult | Trace information - may be nullptr in many cases | |
| TWeakObjectPtr< AActor > | Instigator | Instigator actor, the actor that owns the ability system component | |
| TWeakObjectPtr< UAbilitySystemComponent > | InstigatorAbilitySystemComponent | The ability system component that's bound to instigator | |
| TWeakObjectPtr< UObject > | SourceObject | Object this effect was created from, can be an actor or static object. | |
| FVector | WorldOrigin | Stored origin, may be invalid if bHasWorldOrigin is false |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FGameplayEffectContext
(
AActor* InInstigator, |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddActors
(
const TArray< TWeakObjectPtr< AActor >>& IActor, |
Add actors to the stored actor list | |
| void | AddHitResult
(
const FHitResult& InHitResult, |
Add a hit result for targeting | |
| void | AddInstigator
(
AActor* InInstigator, |
Sets the instigator and effect causer. | |
| void | AddOrigin
(
FVector InOrigin |
Adds an origin point | |
| void | AddSourceObject
(
const UObject* NewSourceObject |
Sets the object this effect was created from. | |
| bool | CanActorReferenceBeReplicated
(
const AActor* Actor |
||
| FGameplayEffectContext * | Duplicate () |
Creates a copy of this context, used to duplicate for later modifications | |
| const UGameplayAbility * | GetAbility () |
Returns the CDO of the ability used to instigate this context | |
| const UGameplayAbility * | Returns the specific instance that instigated this, may not always be set | ||
| int32 | Gets the ability level this was evaluated at | ||
| const TArray< TWeakObjectPtr< AActor > > & | GetActors () |
Returns actor list, may be empty | |
| AActor * | Returns the physical actor tied to the application of this effect | ||
| FHitResult * | GetHitResult () |
Returns hit result, this can be null | |
| const FHitResult * | GetHitResult () |
Returns hit result, this can be null | |
| AActor * | Returns the immediate instigator that applied this effect | ||
| UAbilitySystemComponent * | Returns the ability system component of the instigator of this effect | ||
| const FVector & | GetOrigin () |
Returns origin point, may be invalid if HasOrigin is false | |
| AActor * | Should always return the original instigator that started the whole chain. | ||
| UAbilitySystemComponent * | Returns the ability system component of the instigator that started the whole chain | ||
| void | GetOwnedGameplayTags
(
FGameplayTagContainer& ActorTagContainer, |
Returns the list of gameplay tags applicable to this effect, defaults to the owner's tags. | |
| UScriptStruct * | Returns the actual struct used for serialization, subclasses must override this! | ||
| UObject * | Returns the object this effect was created from. | ||
| bool | HasOrigin () |
Returns true if GetOrigin will give valid information | |
| bool | True if this was instigated by a locally controlled actor | ||
| bool | True if this was instigated by a locally controlled player | ||
| bool | NetSerialize
(
FArchive& Ar, |
Custom serialization, subclasses must override this | |
| void | SetAbility
(
const UGameplayAbility* InGameplayAbility |
Sets the ability that was used to spawn this | |
| void | SetEffectCauser
(
AActor* InEffectCauser |
Modify the effect causer actor, useful when that information is added after creation | |
| FString | ToString () |
Returns debug string |