Hi !
I’m not sure to understand how the replication of the player state works. Well I was “understanding it” before I tried, be now after 5 hours of frustration I’m not so sure I understand!
I stored the player score in a custom player state. I’m then accessing all the player state from the game state ( “PlayerArray” ). Up to there everything works fine, but when I access my “ScoreData”, it’s always empty on the client side, but not on the server side.
So, this is how I initialize the ScoreData ( in the player state itself ) :
Then if I try to access the ScoreData from the server it works. But not in the client. To test it, I added a print in the character ( not the controller ). So the character get its player state, and print the “display name” of the score data :
There’s the result :
Everything works fine on the server side… If I kill someone from the server, it’ll show up in the score on the server side. If I kill someone on the client side, It will show up in the server side score ( in the widget ).
But I can’t get the widget to show up on the client side, because the ScoreData is always null… To add the “kill and dead” numbers to the score when a character is killed, I access the player state ( using GetPlayerState on the PlayerCharacter ). The only difference is I’m on the server side, but it’s suppose to be replicated… ( And yes, the “ScoreData” is set to replicate )
This was the part I thought was the most “weird”. But in fact the problem is when i’m trying to access the data from a widget on client side ( not from the character )
The “ScoreData” in the Player State is null after the cast… It’s the same behavior here, If I print when In the server it show two “ScoreData” “DisplayName”, but when I hit tab on the client side, it shows nothing ( the ScoreData is null )
Anyone know what I’m doing wrong ?
Thanks!
Edit :
I forgot to say, I’m not using a dedicated server