How can I replicate a Static Array over a network?

I have put every effort into replicating and array of strings over the network. Is there just something I am missing in my though process? I am planning on storing the names of all the players each team of my multiplayer game in the extended GameState class.

The menu Hud has a button for each team that calls UpdateTeams on click passing in the team color and player name. Within it I switch off the color and modify the team array. What I don’t understand is that this formula worked on an int32 and even Texture2D. What extra needs to be done for arrays?

ATestGameState.h

UPROPERTY(ReplicatedUsing=UpdatePTeam, BlueprintReadOnly, Category = Team)
FString PinkTeam[3];

UFUNCTION(Reliable, Server, WithValidation)
void UpdatePTeam(const FString& player);

bool UpdateTeams(FString player, ETeamColors team);

#Dynamic Array

Have you tried using a Dynamic Array (just for comparison sake and more debug info )

UPROPERTY(ReplicatedUsing=UpdatePTeam, BlueprintReadOnly, Category = Team)
TArray<FString> PinkTeam;

just for completeness can you also post your DOREPLIFETIME code ?

Rama

Sure thing.

void ANNRGameState::GetLifetimeReplicatedProps(TArray< FLifetimeProperty> & OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME(ANNRGameState, PinkTeam)
	DOREPLIFETIME(ANNRGameState, TealTeam)
	DOREPLIFETIME(ANNRGameState, OrangeTeam)
}

This there something different in how TArray is replicated versus FString bar[x]?

Your original example should work, I’ve just tested it in QAGame, and it checks out fine.

I put a UE_LOG inside the OnRep callback, and it printed out the expected string values.

That’s strange it may have just been something else interfering then. I have got it to work with non-replicated arrays being updated through RPC calls.