Hello all! I’m encountering an issue with dynamic gameplay tags in Unreal Engine 5 while using the Gameplay Ability System (GAS). My system applies GameplayEffect
Specs dynamically to an AbilitySystemComponent
(ASC) and uses AddDynamicAssetTag()
to attach gameplay tags at runtime. However, the dynamic tags seem to disappear from the ASC after the GameplayEffect
is applied (do note that I apply multiple of these GameplayEffect
Specs to the same ASC).
Here’s what I’m experiencing:
-
The tags are correctly added to the
FGameplayEffectSpec
before applying theGameplayEffect
. I confirmed this by checkingDynamicAssetTags
on the spec before callingApplyGameplayEffectSpecToSelf()
. -
After applying the
GameplayEffect
, the dynamic tags are no longer present in the ASC’s owned tags. I checked this usingASC->GetOwnedGameplayTags()
and verified that other effects (like attribute changes) from theGameplayEffect
are still applied. -
The tags are not persistent, even though I expect them to last as long as the
GameplayEffect
is active.
Here’s a simplified example of my code:
FGameplayEffectSpecHandle specHandle = ASC->MakeOutgoingSpec(effectClass, 1.f, ASC->MakeEffectContext());
if (specHandle.IsValid())
{
FGameplayTag customTag = UGameplayTagsManager::Get().RequestGameplayTag(FName("CustomTag.Example"));
specHandle.Data->AddDynamicAssetTag(customTag);
FActiveGameplayEffectHandle newHandle = ASC->ApplyGameplayEffectSpecToSelf(*specHandle.Data.Get());
if (newHandle.IsValid())
{
UE_LOG(LogTemp, Log, TEXT("AppliedGameplayEffect with tag: %s"), *customTag.ToString());
}
}
Later, when I query the ASC for owned tags like this:
FGameplayTagContainer appliedTags;
ASC->GetOwnedGameplayTags(appliedTags);
for (const FGameplayTag& tag : appliedTags)
{
UE_LOG(LogTemp, Log, TEXT("Tag on ASC: %s"), *tag.ToString());
}
TLDR:
- Why are the dynamic tags disappearing after applying the
GameplayEffect
? - Are there additional settings or steps required to make sure dynamic tags persist while the
GameplayEffect
Spec is active? - Is this the intended behavior of dynamic tags, or could this be a bug?
Any insights or advice would be amazing!