Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Cast to playerstate always fails from character blueprint


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


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

Product Version: UE 4.15
more ▼

asked Apr 25 '17 at 09:17 PM in Blueprint Scripting

avatar image

17 4 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

alt text

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.

more ▼

answered Apr 26 '17 at 04:46 AM

avatar image

728 20 25 108

avatar image ShadowDogeLeo Apr 26 '17 at 09:45 PM

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.

avatar image Miroac Apr 27 '17 at 01:33 AM

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:

alt text

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

alt text

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

alt text

Now I get this result on begin play:

alt text

mygamemode.png (24.0 kB)
myplayerstate.png (202.0 kB)
mypawn.png (270.4 kB)
result.png (964.7 kB)
result.png (964.7 kB)
avatar image ShadowDogeLeo Apr 28 '17 at 09:33 PM


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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question