x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why are PlayerState variables not replicating on client?

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.

Product Version: UE 4.8
Tags:
more ▼

asked Oct 03 '15 at 09:39 AM in Using UE4

avatar image

lavamadness
31 2 3 4

avatar image lavamadness Oct 03 '15 at 11:20 PM

I've tried specifying the PlayerState as the Owner when I spawn the Faction. On the client, the Owner is only replicated for the Faction associated with the first player on the Server.

When a 3rd player (2nd client) joins, the Owner is not replicated for the Factions assigned to the client players.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question