cast to custom player state always fails??

hi can anyone help i don’t understand why this cast is failing.

i have checked and the player controller is valid. i have set the custom game mode in my level and all the settings are correct but no matter what i do this cast always fails.

thanks

Check world settings for game mode override, and make sure you are actually using the correct player state. Try resetting the options to your custom player state.

1 Like

What bp is this called in and when?

It’s possible depending on when and where it’s called before it spawns the playerstate if above mentioned is set right

It’s called from inside my login widget blueprint. After player presses the login button. I’m copying the code across from my other project and it works fine there I just don’t get what I have missed . The project was based from a c++ project but the player state I made comes from the blueprint menu would this make a difference ?

Might be wrong but don’t you have to get PlayerState from GameState?

Thanks but those are mixed messages half people saying it should work and half saying you have to use the array but this doesn’t make sense because then you need to distinguish between which player controller and which player state between each one and also I used get controller in my other project and the cast doesn’t fail so this is why I’m confused

Also the playerstate would return invalid

ok its definatly a bug just did the exact same setup in my other project and it works fine

inside widget

inside custom playerstate

and when i run the game and press the button it calls the custom function and prints the message

i guess umg in 4.14 is bugged will have to upgrade to 4.15

thanks anyway guys

1 Like

Not still sure about this, but I think Epic has messed around with PlayerState a little bit. It´s getting harder for me to use them now too, but I´ve been useing them in older revs and everything was okay.