Gameplay effect inconsistently applied to a target


I’m trying to implement a simple periodic health regen gameplay effect.

My set-up is the following:

  • HealthAttributeSet has 3 properties: Health, HealthMax and HealthRegenRate

  • HealthComponent(ActorComponent) adds HealthAttributeSet to its owner’s AbilitySystemComponent on BeginPlay, and applies a gameplay effect set in the editor.

  • The set gameplay effect has one modifier on Health, based on AttributeBased HealthRegenRate.

Here is my HealthComponent code:

void HealthComponent::BeingPlay() {  
  auto HealthAttributeSet = NewObject<UHealthAttributeSet>(AbilitySystemComponent);  
  if (HealthEffect) {  
    FGameplayEffectContextHandle ContextHandle(
    FGameplayEffectSpec Spec(HealthEffect.GetDefaultObject(), ContextHandle);  

Also, MyCharacter code:

void AMyCharacter::PossessedBy(AController* NewController)
    AbilitySystemComponent->InitAbilityActorInfo(NewController, this);

The warning I get at every periodic event, and the gameplay effect doesn’t affect the character at all, as the gameplay effect fell back to 0:

Warning: Modifier on spec: Default__GEHealth_C was asked to CalculateMagnitude and failed, falling back to 0.

Sometimes, I don’t even see the warning, nor other simpler gameplay effects (i.e. instant damage) silently fail to apply to the target.

Thanks for reading and offering your help. :slight_smile:

I’m the author. Esentially, I was seeing inconsistent application of gameplay effects, and I believe I found a solution.

I originally set the avatar and owner of the AbilitySystemComponent to be the Character and the Controller that owns the Character.
Which was okay, but what’s not okay was that my Controller didn’t implement IAbilitySystemInterface, failing to create complete GameplayEffectSpec (missing InstigatorAbilitySystemComponent).

solution is either Controller implementing IAbilitySystemInterface, or setting character as both owner and avatar.
I chose the latter because in my game the character owns all the abilities it uses anyway, and I didn’t see the need to go with the former at the moment.

I was able to debug the issue thanks to engine code debugging symbols, which I got from Epic Launcher.