Question about GAS. PostGameplayEffectExecute doesn`t get called when it supposed to

I have two attributes in my attribute set that i want to clamp: Health and Stamina. From some tutorials i saw that it can be done in the PostGameplayEffectExecute function. So i wrote the code as it was there. And it perfectly works with Stamina but not in the case with the Health. I have no idea why is that. The only difference between those attributes is that Stamina effect gets called from the ability as a cost and the Health effect gets called externally from an actor blueprint.

Find this post because of my own mistake. In tranek’s GAS docs it’s said that post ge execute is called only for base value changes, and in my case I changed only current value.

To react to changes of current value, it’s recommended to use GetGameplayAttributeValueChangeDelegate provided by ASC.


AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(AttributeSetBase->GetHealthAttribute()).AddUObject(this, &AGDPlayerState::HealthChanged);

// Important! This delegate will be called to future changes, but not to the initial one, so need to call manually
ReactToHealthChanged(AttributeSetBase->GetHealth());

In Lyra, changes to current value are handled by health component, something similar to code above is in it’s method InitializeWithAbilitySystem.

1 Like