We have some smoke tests that run on editor startup which test the replication of various structs to verify that they fit within a given size threshold, and that we can properly serialize and deserialize some test data within those structs. The Automation Test Framework runs these tests before GFPs have been loaded. During these tests, the first call to `FGameplayTag::NetSerialize()` triggers a call to `UGameplayTagsManager::ConstructNetIndex()` to build an index of all of the currently registered gameplay tags. `ConstructNetIndex()` is not called again after this point, so any gameplay tags that are registered by loaded GFPs do not get a valid NetIndex assigned. Attempting to replicate one of these tags triggers the check statement in `FGameplayTagNode::GetNetIndex()`.
The problem seems to be in `UGameplayTagsManager::HandleGameplayTagTreeChanged()`. This is called from `UGameplayTagsManager::AddTagIniSearchPath()` when a GFP’s tags are registered, but `bDoneAddingNativeTags` is still false, so the logic that would invalidate the constructed network index is skipped. When `UGameplayTagsManager::DoneAddingNativeTags()` is called, it considers all of the gameplay tag search paths from the GFPs as properly searched and added, so it doesn’t reconstruct the tree at that time.
We’ve worked around this by adding a call to `InvalidateNetworkIndex()` at the top of `UGameplayTagsManager::HandleGameplayTagTreeChanged()`.
void UGameplayTagsManager::HandleGameplayTagTreeChanged(bool bRecreateTree)
{
if (ShouldUseFastReplication())
{
InvalidateNetworkIndex();
}
// Don't do anything during a reconstruct or before initial native tags are done loading
if (!bIsConstructingGameplayTagTree && bDoneAddingNativeTags)
{
[Attachment Removed]