A UDN user found that calling
AbilitySystemComponent->RemoveReplicatedLooseGameplayTag(TagToRemove);
while the gameplay tag was not in the TagMap, will create an entry for it with count 0, see FMinimalReplicationTagCountMap::RemoveTag. Then, since FMinimalReplicationTagCountMap::NetSerialize serializes all keys without regard for count, simulated proxies will think the tag is in the map.
I was able to repro this behavior 100% with the actor code shared under repro steps.
Create an actor as below, with TagToRemove being an UPROPERTY(EditAnywhere) FGameplayTag that's set to a valid tag:
ATestActor::ATestActor() { bReplicates = true; PrimaryActorTick.bCanEverTick = true; AbilitySystemComponent = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("ASC")); AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Minimal); AbilitySystemComponent->SetIsReplicated(true); } void ATestActor::PostInitializeComponents() { Super::PostInitializeComponents(); AbilitySystemComponent->AddSet<UAttributeSetNew>(); } void ATestActor::BeginPlay() { Super::BeginPlay(); if (HasAuthority()) { AbilitySystemComponent->RemoveReplicatedLooseGameplayTag(TagToRemove); } } void ATestActor::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); const bool bHasAuth = HasAuthority(); const bool bHasTags = AbilitySystemComponent->HasMatchingGameplayTag(TagToRemove); UE_LOG(LogTemp, Warning, TEXT("Has auth: %d, Has tag: %d"), bHasAuth, bHasTags); }
At runtime, the server will "remove" a tag but instead this will add an entry into the replicated TagMap with count 0. On the client, HasMatchingGameplayTag then evaluates to true. Once fixed, it should correctly evaluate to false on the client.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-170468 in the post.
3 |
Component | UE - Gameplay - Gameplay Ability System |
---|---|
Affects Versions | 5.0, 5.1, 5.2 |
Target Fix | 5.3 |
Created | Nov 17, 2022 |
---|---|
Resolved | Feb 9, 2023 |
Updated | Sep 21, 2023 |