I have the following two classes in blueprints:
Faction, based on Actor with “Replicates” and “AlwaysRelevant” set to true.
Faction contains a PlayerState variable that is set to RepNotify.
MyPlayerState, based on PlayerState with “Replicates” and “AlwaysRelevant” set to true.
MyPlayerState contains a Faction variable that is set to RepNotify.
When I start a 2 player network game and level Event BeginPlay occurs, the server spawns and assigns a new Faction to each PlayerState.
On the client, the following sequence of events occurs:
LogWorld: ----SeamlessTravel finished------
MyPlayerState_C_8 BeginPlay
MyPlayerState_C_9 BeginPlay
Faction_C_0.OnRep_CityArray
Faction_C_0.Event BeginPlay
Faction_C_1.OnRep_PlayerState: MyPlayerState_C_9
Faction_C_1.OnRep_CityArray
Faction_C_1.Event BeginPlay
MyPlayerState_C_9.OnRep_FactionActor
MyPlayerState_C_9.OnRep_Faction: Faction_C_1
GameScreen.Event Tick: Faction is None for MyPlayerState_C_8
GameScreen.Event Tick: Faction is None for MyPlayerState_C_8
GameScreen.Event Tick: Faction is None for MyPlayerState_C_8
GameScreen.Event Tick: Faction is None for MyPlayerState_C_8
On the client, Faction_C_0.PlayerState never gets set to MyPlayerState_C_8. MyPlayerState_C_8.Faction never gets set to Faction_C_0. These are the instances that are associated with local Player Controller (index 0) on the client, but I’m not sure if that matters.
Why are these two variables not replicated?
The CityArray variable for both Faction instances is replicated. The FactionAction variable is an Actor* I added in C++ in case the replication was buggy only in blueprints, and it is also only replicated for the one Faction instance. An integer variable also replicates for both Faction instances.