Cast to playerstate always fails from character blueprint

Hi,

Im trying to get the player state in my character blueprint but it keeps on failing. I’ve tried adding a delay before the nodes for casting it and i’ve tried accessing it from the HUD widget (as that’s the only thing using the data from it currently). The world settings and project settings are all correct with the right player state class.

It is running off the BeginPlay node in my character BP

http://prntscr.com/f0swh8

Im out of ideas for what could be causing it as I can get into the game state just fine and access the variables in that but not the playerstate.

Thanks,
Leo

Hey ShadowDogeLeo,

I didn’t have this issue, I have been able to get the player state and also call a custom event on it.

I think the issue you are having is that you haven’t set the player state in the game mode.

If you haven’t set the player state in the game mode than your player state will be the default player state instead of your custom Trail_Player state.

http://prntscr.com/f18a8f Everything is set correctly (project settings, gamemode class, world settings) i don’t think there’s anywhere else I need to change it.

Im really stumped as to why this isn’t working.

Hey ShadowDogeLeo,

In your original graph you are casting to the player state and than… nothing. So I’ll show you how I was able to test that I was getting a result so that you can run the same test on your end.

First starting with MyGamemode setup where I plug in MyPawn and MyPlayerState:

135713-mygamemode.png

Than in MyPlayerState I setup a variable and a custom event:

Finally I call the new player state and change the variable before calling the custom event from MyPawn:

Now I get this result on begin play:

Hey!

Sorry about the late response. This did wonders for me and it ended up being a logic error on my end. Fixed it now and only identified the problem thanks to this trick! Thanks!