UAttributeSet::PreAttributeChange

An "On Aggregator Change" type of event could go here, and that could be called when active gameplay effects are added or removed to an attribute aggregator.

Windows
MacOS
Linux

References

Module

GameplayAbilities

Header

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

Include

#include "AttributeSet.h"

Syntax

virtual void PreAttributeChange
(
    const FGameplayAttribute & Attribute,
    float & NewValue
)

Remarks

An "On Aggregator Change" type of event could go here, and that could be called when active gameplay effects are added or removed to an attribute aggregator. It is difficult to give all the information in these cases though - aggregators can change for many reasons: being added, being removed, being modified, having a modifier change, immunity, stacking rules, etc. Called just before any modification happens to an attribute. This is lower level than PreAttributeModify/PostAttribute modify. There is no additional context provided here since anything can trigger this. Executed effects, duration based effects, effects being removed, immunity being applied, stacking rules changing, etc. This function is meant to enforce things like "Health = Clamp(Health, 0, MaxHealth)" and NOT things like "trigger this extra thing if damage is applied, etc".

NewValue is a mutable reference so you are able to clamp the newly applied value as well.

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