Gameplay Attributes
What are Gameplay Attributes?
Gameplay Attributes are the numerical values that define a character’s statistics:
Health, Stamina, Mana, Strength, Defense, Attack Power, and so on.
They are stored and synchronized by Unreal’s Gameplay Ability System (GAS), which ensures every stat change — like taking damage, regenerating health, or gaining a buff — is automatically network-replicated and predictable.
In short, attributes are the variables that represent your gameplay data inside GAS.
Where Attributes Live
Attributes live inside special classes called AttributeSets (UAttributeSet).
Each AttributeSet contains a group of related values — for example, you could have:
UACFSt→ Health, Stamina, ManaURPGAttributeSet_Combat→ Strength, Dexterity, D
Example:
UCLASS()
class URPGAttributeSet : public UAttributeSet
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadOnly, Category = "Attributes", ReplicatedUsing = OnRep_Health)
FGameplayAttributeData Health;
ATTRIBUTE_ACCESSORS(URPGAttributeSet, Health)
UFUNCTION()
void OnRep_Health(const FGameplayAttributeData& OldValue) const;
};NOTE: IN ACF YOU CAN GENERATE THIS CODE AUTOMATICALYL WITH THE ATTRIBUTE CREATOR!
JUST CLICK IV → ATTRIBUTE CREATOR and add in to the array the name of your Attributes. Select then the name of the Generated
Base Value vs Current Value
Each attribute internally tracks two distinct values:
Property | Description |
|---|---|
Base Value | The character’s “true” value before any effects are applied (e.g., your max Health before buffs). |
Current Value | The actual value after all modifiers, effects, or temporary changes are applied (e.g., your Health after receiving damage or buffs). |
Example:
Base Health = 100
A buff adds +20% Health → Current Health = 120
You take 50 damage → Current Health = 70
When the buff expires, Base remains 100, Current returns to 50.
Attribute Lifecycle and Callbacks
When a Gameplay Effect modifies an attribute, GAS automatically triggers a series of callbacks in the AttributeSet.
Common Override Functions
virtual void PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) override;
virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
PreAttributeChange
Called before the value changes.
You can use it to clamp or adjust the incoming value:
void UMyAttributeSet::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
{
if (Attribute == GetHealthAttribute())
{
NewValue = FMath::Clamp(NewValue, 0.f, GetMaxHealth());
}
}
PostGameplayEffectExecute
Called after an effect has modified the value.
Used for game logic such as detecting death, regeneration, or triggering abilities:
NOTE: IN ACF CLAMPS ARE FULLY AUTOMATIC!
How Attributes Are Modified
Attributes are modified through Gameplay Effects (GEs) — data assets that describe “what” and “how much” to change.
Each modifier inside a GE defines:
Target Attribute (Health, Stamina, etc.)
Operation Type (Add, Multiply, Divide, Override)
Magnitude (the value or calculation to apply)
When a Gameplay Effect is applied:
GAS calculates the magnitude (taking into account other tags, attributes, or curves).
It modifies the Current Value of the target attribute.
Triggers callbacks (
PreAttributeChange,PostGameplayEffectExecute, replication, etc.).
AttributeSets and Gameplay Effects – Typical Flow
Player uses an ability that applies a Gameplay Effect.
The Gameplay Effect modifies an Attribute (e.g. subtracts Health).
GAS calls
PreAttributeChange→ clamps the value.GAS updates the CurrentValue.
GAS calls
PostGameplayEffectExecute→ triggers logic like death or regeneration.GAS replicates the new value to clients.
Client
OnRep_Healthupdates the UI.