PlayerController instanced before PlayerState on server, other way around for client


In my playerstate I made some code that fetches an unused spawnpoint from the gamestate. the transform of this spawnpoint is saved to a variable. From the playercontroller, I get the playerstate from the reference and then fetch the variable I just set. From there, I spawn an actor with the transform.

It all works well, except when running unreal engine in the editor with 2 players, the server runs PlayerController before PlayerState, which causes PlayerState to not exist… For the client it’s the other way around, which is why the client works correctly.

I’m not sure if this is correct behaviour and/or what I can do to make it so I’m actually making a correct connection between these two things. As the PlayerState seems to be something more global than playercontroller, you’d assume it’s always loaded in first…

Can anyone help me?

This is my PlayerState, it’s on the BeginPlay Event

This is my PlayerController.

Note: the code works, as on the client it does what I’d expect…