GameplayAbilities plugin and UI

I started using the GameplayAbilities API (that was moved as a plugin with 4.15) for my game, the problem is documentation, I’ve already read [that famous forum post][1] and the other [wiki link][2], but they are too simple and don’t go in detail.

My design problem is how to update the UI using the GameplayAbilities API.

I need two simple things:

  1. How to update a Buff icon with useful information like time
    remaining,ability level and spell name (should
    I use a GameplayCue?)
  2. How to update a casting progress bar

I know the basics of the GameplayAbilities API but there is no documentation about what is the best way to update the UI.

At this point I’m considering the idea of making my own abilities library than to use the Unreal’s one without documentation.

Thanks.

137487-18342276_10213541317276997_6756892800881991819_n.jpg

Not to beat a dead horse, but this reason is why I created Able.

This is a very late answer but maybe someone else hits this.

  1. Can be achieved by searching for active gameplay effects by tag, and then using the handle. There’s a convenience method for getting just the time remaining but this way can give all three examples:

     FGameplayEffectQuery Query = FGameplayEffectQuery::MakeQuery_MatchAllOwningTags(FGameplayTagContainer(FGameplayTag::RequestGameplayTag(TEXT("Effect.MyAwesomeBuff"))));
     TArray<FActiveGameplayEffectHandle> ActiveEffects = AbilitySystem->GetActiveEffects(Query);
     for (auto Handle : ActiveEffects)
     {
     	const FActiveGameplayEffect* ActiveEffect = GetActiveGameplayEffect(Handle);
    
     	// Time Remaining
     	ActiveEffect->GetTimeRemaining();
    
     	// The CDO of the ability
     	ActiveEffect->Spec.GetEffectContext().GetAbility();
    
     	// The level of the ability
     	ActiveEffect->Spec.GetEffectContext().GetAbilityLevel();
     }
    

You may need to add the ability to the context yourself before applying the effect, and the above can be accessed from UI widgets by getting the ability system from the owning player pawn. I would strongly recommend writing convencience methods for it, storing the handle and only calling when there’s a tag change on the owning player (use the delegate).

  1. Is more difficult to do automatically since it’s probably tied to a notify in the animation, which is probably a montage and might have variable length, and cast speed. You could create an effect with a duration of the anim length * cast speed and then use the method from 1, or put a variable on the character and update that with a timer each time an ability is activated. Both you’ll need to know ahead of time how long the animation goes for by default. CommitAbility is virtual so it can be a good place to put these kinds of things.