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:
AddTag(GameplayEffect.Weapon.Equipped.Primary)
RemoveTag(GameplayEffect.Weapon.Equip.Primary)
(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
AddTag(GameplayEffect.Weapon.Equip.Primary)
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.Def>InheritableOwnedTagsContainer.CombinedTags); 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:
AddTag(GameplayEffect.Weapon.Equip.Primary)
AddTag(GameplayEffect.Weapon.Equipped.Primary)
RemoveTag(GameplayEffect.Weapon.Equip.Primary)
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.
i have this problem UE4CC-Windows-58DC12AF4B97F057BD108FBFF569B2E9_0000
I am not able to find world outliner how to enable it?
How can i modify the param name in EQS node
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Delay nodes occasionally don't fire the "Completed" output in a nativized build
How does UMG set overlapping layouts?
How to achieve HLSL Multiple Render Target in Material blueprints?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-148368 in the post.
3 |
Component | UE - Gameplay - Gameplay Ability System |
---|---|
Affects Versions | 4.25, 5.0 |
Target Fix | 5.3 |
Created | Apr 6, 2022 |
---|---|
Resolved | Mar 6, 2023 |
Updated | Apr 29, 2023 |