UGBAAttributeSetBlueprintBase::​

K2_PreAttributeChange#

  • Declared in "Abilities/GBAAttributeSetBlueprintBase.h"
public:
UFUNCTION(
BlueprintImplementableEvent, Category = "AttributeSet", DisplayName = "PreAttributeChange")
void K2_PreAttributeChange(
const FGameplayAttribute& InAttribute,
float InValue,
float& OutValue
)

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".

OutValue is a mutable reference so you are able to clamp the newly applied value as well (Note When overriding in BP, this is the return value of the BP function, make sure to pass in the new value. Typical implementation should simply return the input value parameter)

Parameters#

  • const FGameplayAttribute& InAttribute

    The Gameplay Attribute whose value is about to change

  • float InValue

    Original value for the Gameplay Attribute

  • float& OutValue

    Return value of the function which represents the new value for the Gameplay Attribute