Description

Context

AbilitySystemComponent has a virtual function

 

virtual void OnTagUpdated(const FGameplayTag& Tag, bool TagExists);

that gets called when a gameplay tag gets added or removed, so whenever a gameplay tag's count changes states between zero and non-zero.

Problem

A licensee has reported that this function is not called when setting a tag's count directly via

void UAbilitySystemComponent::SetLooseGameplayTagCount(const FGameplayTag& GameplayTag, int32 NewCount); 

while it does get called via other APIs like Add/RemoveLooseGameplayTagCount(). I confirmed both those observations.

Suggestion

SetLooseGameplayTagCount() should cause OnTagUpdated() to be called when the call causes the tag to change states between present and not-present.

 

Steps to Reproduce
  • Create a native subclass UMyAbilitySystemComponent from UAbilitySystemComponent
  • Override OnTagUpdated, print the tag name and put a breakpoint on there
  • Give some actor a UMyAbilitySystemComponent
  • In that actor's native BeginPlay call ASC->SetLooseGameplayTagCount(SomeTag, 1)
  • Observe: OnTagUpdated is not called
  • Expected: Because the count changed from 0 -> 1, OnTagUpdated is called
Callstack

Non-fatal, just for reference: 

>    [Inline Frame] UnrealEditor-GASRepro53.dll!UAbilitySystemComponent::SetTagMapCount(const FGameplayTag &) Line 622    C++
     [Inline Frame] UnrealEditor-GASRepro53.dll!UAbilitySystemComponent::SetLooseGameplayTagCount(const FGameplayTag &) Line 687    C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-233798 in the post.

0
Login to Vote

Unresolved
ComponentUE - Gameplay - Gameplay Ability System
Affects Versions5.45.25.35.5
Target Fix5.6
CreatedDec 10, 2024
UpdatedJan 24, 2025
View Jira Issue