Player state cast not working

Hi!
I am trying to make an online game with a lobby system and different game modes (everything done trough blueprints).
I have come across a really weird problem while working to a gamemode.
In the graph below i was trying to print the name of each player trough their player states (which i got form the class gamestate).

this code works perfectly and all the names are printed, but as soon as i try to cast the player states to another player state class created by me (as shown in the graph below) the cast fails and the names wont be printed.

Both the graphs start from the beginplay event in the gamemode and they are only executed by the server.

Hey Marvash-

Can you confirm that your custom player state is set as the player state in the World Settings. To do this you will need to create a custom Game mode (if you don’t have one already) and set your player state in the new game mode, then set the new game mode as the default game mode. Additionally, try opening Edit->Project Settings->Maps & Modes and set your custom GameMode as the default GameMode there as well.

Cheers

Hi ,
Yes my game mode is setted up properly and i am using that gamemode in the map so that can’t be the problem.
I recently found out a way to make it work.
Adding a Delay before the for each loop fixes everything and the cast works (the names are printed). The funny thing is that the delay can also be of 0 seconds which makes me think that this is just a blueprint bug.
Here is a picture of the code as it is now

I had a similar issue, but it was only happening when playing as multiple players through the editor. When only playing as single player it worked fine. Thanks for the fix!

Hey GamingByNumbers-

Can you provide your setup and reproduction steps? I tried creating a game mode blueprint and player state blueprint. When I set the player state in my Game mode blueprint and PIE I see my blueprint in the world outliner. Let me know if this is similar to what you’re doing or if you’re using a different setup.

I found this thread having the same issue. I have my custom GameMode being used, and my custom GameMode has its default set to my custom PlayerState. However, when I run the game and look at the WorldOutliner, the starter PlayerState is used instead of mine.