Hey all,
I’ve been trying to figure out a way to get an in world multiplayer scoreboard working. After several days of failing, I’ve boiled it down (I think) to this issue:
Getting the player array from the game state, then casting to your custom player state, does not return the client’s variables. It returns the local player state variables.
Here’s my test event (this is in my Game State):
The above BP will print twice (as it’s a 2 player game, and the player array correctly shows 2 connected players). If I add a debug print for each array element, it correctly shows 2 different player states.If I add a debug print after the cast to my custom player state, it shows the 2 unique custom player states. But the variables it returns are only from the local custom player state.
The end result is both prints will be the local variables (player name and current lives). Note that Struct_PlayerData and LivesCurrent are both replicated, and I have a delay earlier in the execution chain to ensure that the player states have all loaded before this event is run.
The issue seems to be with the cast to my custom BP_PlayerState. After that cast, the event is only looking for my local BP_PlayerState, and I have no idea how to fix it as I have to cast to retrieve the variables.
Any ideas?