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"

Player state Casting fails on event begin play?

Hello friends,

I am trying to get the variable from player state in my multiplayer game at the event begin play but casting fails, And if I try that casting on key event press that time I am able to access the value from player state. I don't know what the hell is happening in this case. Please help me.alt text

Product Version: Not Selected
capture.jpg (81.8 kB)
capture1.jpg (82.3 kB)
more ▼

asked Mar 04 '15 at 11:13 AM in Blueprint Scripting

avatar image

Ganesh Mune
10 5 7 10

avatar image TheCompScientist Mar 04 '15 at 11:24 AM

Just curious: What does the GameMode look like, can you post screenshots of it? and do you have HubZero_PlayerState set in your GameMode as shown below?alt text

Also is the GameMode where you have PlayerState set currently active in the level you are testing this BP out in?

The cast will fail if the PlayerState you are getting does not match the PlayerState you have set in the GameMode properties.

Also is your GameMode in C++ or Blueprints?

capture.png (34.0 kB)
avatar image Ganesh Mune Mar 04 '15 at 01:09 PM

Hi friend, This is how it looks alt text

My game mode is in BP And the same game mode is active in my level in which I am testing.

capture2.jpg (57.8 kB)
avatar image TheCompScientist Mar 05 '15 at 12:46 AM

Judging by that screenshot: Are you still on 4.6?

avatar image Ganesh Mune Mar 09 '15 at 06:29 AM

Yes I am using 4.6

avatar image Purecyn Mar 05 '15 at 03:15 AM

Try a delay loop and see if that changes the outcome; I'm just curious. See my post https://answers.unrealengine.com/questions/183488/player-controller-get-controlled-pawn-client-delay.html

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

2 answers: sort voted first

Get Player Pawn > Get Player State > Cast

You could also add a delay

more ▼

answered Mar 05 '15 at 02:07 AM

avatar image

DG Gage
1.7k 62 31 129

avatar image Inph1del Apr 24 '16 at 11:16 AM

I had same problem and the delay did fix it.

avatar image Rudy Q ♦♦ STAFF Sep 28 '16 at 08:36 PM

Hello Ganesh Mune,

I wanted to add that you may want to use Get Controller inside of your character blueprint so that you can get the controller that is currently being used by that specific client.


alt text

Make it a great day

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

The suggestions to use a delay or put the logic into Tick give me the heebie jeebies as a programmer. Instead, my solution for solving the issue where PlayerState was null/unavailable until a few frames after BeginPlay was to put my logic in an overridden version of ACharacter::OnRep_PlayerState(). This gets called as soon as the PlayerState is first assigned, or ever changes.

more ▼

answered Mar 16 '19 at 03:58 PM

avatar image

6 1 2

(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