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 actor`s integer to Widget

hi everyone,

I have a question about how to work normal cast to BP(actor) as cast to pawn? i try to use Get Owning Player, and it still warning.

thank you!

alt text

Product Version: UE 4.20
widget.png (286.5 kB)
more ▼

asked Dec 05 '18 at 09:28 AM in Blueprint Scripting

avatar image

1 2 4

avatar image NoCodeBugsFree Dec 05 '18 at 11:54 AM

Hi! if you want know about cast's please check this link text

and in widget blueprint use GetOwningPlayerPawn() it returns the pawn, but GetOwningPlayer() return the PlayerController that owns that UI

avatar image HazelWitcht Dec 05 '18 at 03:13 PM

thanks for the link, but after i read it ,I think there`s no way to cast to actor. or maybe i missed something?

I want to cast to actor because I want to see execute line(orange line) when I run the game, but I can`t see the whole line when I use Character or Pawn.

avatar image Tuerer Dec 05 '18 at 12:56 PM

What is that BP_1205_3 you're casting to?
Is it has something to do with UI and widgets, you have to use Player Controller to reach the UI.

avatar image HazelWitcht Dec 05 '18 at 03:08 PM

i cast to Blueprint(actor) to show the score.

avatar image Tuerer Dec 05 '18 at 03:21 PM

Maybe you should Get Player Character, not a Pawn?

avatar image ThompsonN13 Dec 05 '18 at 11:13 PM

does the player pawn inherit from the class that your casting to? considering you mentioned actor im guessing that its a basic bp actor in which case its likely that the pawn does not inherit from the actor.

it looks to me like your while issue here is about your trying to get a variable from the player so as to display it in the widget. if thats the case then all you need is a reference to the character or pawn that is the player then it needs to be identified enough so as to get the class variable. one method to do this is to get the player pawn then cast to the class that the pawn is. so if your pawn is of the class bp1206pawn then you would cast to that class. another method to get the reference you need would be to create a variable and set its type to the class your looking to target, then when you create the widget you set the variable.

also what exactly does the warning say?

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

0 answers: sort voted first
Be the first one to answer this question
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