UAttributeSet::PreAttributeBaseChange
#include "AttributeSet.h"
Access: public
Specifiers: virtualconst
Description
Called just before an attribute's base value changes when that attribute has an active aggregator. Mirrors the clamping role of PreAttributeChange but for the permanent base value rather than the current value.
Caveats & Gotchas
- • Only fires when the attribute has an FAggregator backing it (active duration-based GameplayEffects); simple instant changes go through PreAttributeChange instead.
- • Marked const, so it must not mutate the AttributeSet itself; it can only clamp NewValue and must not trigger gameplay events or callbacks.
Signature
virtual void PreAttributeBaseChange(const FGameplayAttribute& Attribute, float& NewValue) const { } Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Attribute | const FGameplayAttribute& | The attribute whose base value is about to change. | — |
| NewValue | float& | The base value about to be applied; modify in place to clamp it. | — |
Return Type
void Example
Clamp MaxHealth base value C++
void UMyHealthSet::PreAttributeBaseChange(const FGameplayAttribute& Attribute, float& NewValue) const
{
if (Attribute == GetMaxHealthAttribute())
{
NewValue = FMath::Max(NewValue, 1.f);
}
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?