PlayerState is null on clients

HI!

i have some issue with PlayerState object replication in multiplayer.
For example, i’ve created ThirdPersonExample and in level blueprint i put this nodes to test:

I hit play in editor with 2 clients and dedicated server checked.
log shows me this:

Client 1: Null

Client 1: Valid

Client 1: Valid

Client 2: Null

Client 2: Valid

Client 2: Null

etc.

So, is that normal? I think after PlayerState replicates from server to clients, it shouldn’t be null?

Hello AndrewFord,

I was unable to reproduce this issue on a dedicated server. However, I used pawn inside of my get all actors of class. This appears to have worked for me. If you change yours to use pawn do you still get the same result? If so, I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. What version of the engine are you using?
  2. Can you reproduce this issue in a clean project?
  3. If so, could you provide a detailed list of steps to reproduce this issue on our end?
  1. i’m using 4.7.4, downloaded through launcher
  2. i was doing my test on a clean project (ThirdPersonExample, Blueprint version)
  3. Sure

i’ve just created a clean project. Then, i opened level blueprint

37665-screenshot_20150406233731.png

Hello AndrewFord,

Thank you for providing the information, however after following the steps provided I have still not been able to reproduce this issue on our end. I do have another question for you. Can you replace your “foreachloop” node with a new one? The data will sometimes not update.

I captured the video of this issue.
YouTube
Doubt it should work like this…

Hello AndrewFord,

After watching the video I noticed that the default character for the third person template was still in your level. I know this because you have 3 characters in your level (but only two players). This means when you play this project as a dedicated server there are no players left to possess this character. If you delete the default character out of your level this should solve your issue. I hope that this information helps.

Make it a great day

1 Like

Hi, Rudy!

Yeah, removing the character helps. Thanks for the answer!

Hello.If you are getting player state on event begin then please add a delay of 1-2 seconds before accessing player state.Unreal needs some time to add player states to each player .

2 Likes

PlayerState is replicated via OnRep_PlayerState function, don’t have to guess with timers

1 Like