Overview
This article introduces the usage of gameplay effect context in the Gameplay Ability System and how to customize context data.
Gameplay Effects
According to the GAS Documentation, Gameplay Effect Context is a special structure in GAS used to pass relevant context data in various application processes of GAS (MMC/Execution, AttributeSets, and GameplayCues),
At the same time, it can also be customized through C++ to add custom data.
Since customizing gameplay effect context requires mandatory use of C++, it brings many inconveniences for blueprint developers when utilizing GAS to implement advanced features!
Therefore, GGA provides a better solution, which is gameplay effect context payload system。
Context Payload System
GGA provides a custom gameplay effect context structure:GGA_GameplayEffectContext, which internally contains an array of InstancedStruct, allowing you to dynamically add/remove any data to it, and this data can be understood as “context payload”。
At the same time, GGA provides a simple API to get context payload or modify it through blueprints or C++.
The following image shows an example of using these APIs:

Note
To use the context payload system, you need to selectGGA_AbilitySystemGlobals in Project Settings -> GameplayAbilitiesSettings -> AbilitySystemGlobalsClass.
Best Practices
You can use any blueprint/C++ structure as context payload; however, for these data to be properly serialized over the network, the field types within the structure must support network serialization。
At the same time, I recommend naming your context payload structure types in the form of ContextPayload_XXX.
In my combat system, I use FGCS_ContextPayload_Combat to store all context data related to combat.
