We're on 4.25.4. We recently turned on mixed mode replication for GAS, which seems to work fine and reduce bandwidth as expected. However one of our unit tests started failing with this error message:

 FMinimapReplicationTagCountMap::RemoveTag called on Tag GameplayEffect.Weapon.Equip.Primary and count is now < 0

 Upon investigating, the case in question has a gameplay effect GE_Common_WeaponEquipPrimary being added via ApplyGameplayEffectToSelf which during UpdateTagMap_Internal activates an ability which adds another gameplay effect GE_Common_WeaponEquippedPrimary. The GE_Common_WeaponEquipPrimary effect is added and removed immediately, which leaves the GE_Common_WeaponEquippedPrimary effect on the character.

 I attached the callstack where the error "count is now < 0" appears. The problem is in the order in which updates to MinimalReplicationTags are applied via calls to AddTag/RemoveTag:



(outputs error about "FMinimapReplicationTagCountMap::RemoveTag called on Tag GameplayEffect.Weapon.Equip.Primary and count is now < 0", because the next AddTag hasn't happened yet



The order above is attempting to remove a GE which has not been applied yet.

 I believe the problem is in FActiveGameplayEffectsContainer::AddActiveGameplayEffectGrantedTagsAndModifiers, where the UpdateTagMap calls happens before the minimal tags have the correct counts. Since UpdateTagMap dispatches arbitrary gameplay code, the minimal tag counts must be correct prior to this call so I've changed the order of operations:

// Update the MinimalReplicationTags counts prior to calling UpdateTagMap, since it can call other gameplay logic (such as 	
// adding secondary GEs) which requires the MinimalReplicationTags counts be correct.	

if (ShouldUseMinimalReplication())	
	Owner->AddMinimalReplicationGameplayTags(Effect.Spec.DynamicGrantedTags);	}	

// Update our owner with the tags this GameplayEffect grants them
Owner->UpdateTagMap(Effect.Spec.Def->InheritableOwnedTagsContainer.CombinedTags, 1);	
Owner->UpdateTagMap(Effect.Spec.DynamicGrantedTags, 1);

This updates the MinimalReplicationTags in the correct order:

Steps to Reproduce

I don't have a great way to reproduce this, other than reading the initial bug and duplicating a similar setup where a GE applies another GE instantly.

Have Comments or More Details?

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

Login to Vote

ComponentUE - Gameplay - Gameplay Ability System
Affects Versions4.255.0
Target Fix5.3
Fix Commit24507116
Main Commit24507116
CreatedApr 6, 2022
ResolvedMar 6, 2023
UpdatedApr 29, 2023