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"

Casting character fails


why is my casting to character in PlayerController always fails? Weird thing is that I don´t have any warnings or errors after compile. Yes as object I am using Get Player Character. I thinking if the problem is not in that I am trying to Cast Character inside Controller (but I am not sure). Am I using just bad object or is problem somewhere else?.

Thanks lot for help.

ps. I can provide screenshots but those blueprints are littlebit bigger and there is not just one, so I would be happy to get help just by words but I can provide them if needed :)

Product Version: UE 4.20
more ▼

asked Dec 14 '18 at 10:14 PM in Blueprint Scripting

avatar image

5 2 4 7

avatar image ALegendsTale Dec 14 '18 at 10:28 PM

It's hard to tell exactly what the situation is from what you wrote.

I'd make sure to check that your cast is to "your player character name" and I'd also check what object the GetPlayerCharacter node is returning

avatar image 0r4cl3_My-SQL Dec 14 '18 at 10:30 PM

cast is to correct cahracter, how can I check it what it returns?

avatar image ALegendsTale Dec 14 '18 at 10:43 PM

You can use your mouse to hover over the output pin.

Also it would probably help a lot to see an image or video

avatar image 0r4cl3_My-SQL Dec 14 '18 at 10:50 PM

problem is before selected PrintString (debug) on picture cast-1, outher pictures are just functions and input function

cast-1.png (365.2 kB)
input.png (279.2 kB)
updt-anim.png (114.5 kB)
updt-dir.png (129.1 kB)
avatar image Nebula Games Inc Dec 15 '18 at 12:02 AM

Have you tried "get player pawn", I don't know what your class inherits from, it may not be the player character base class

avatar image ALegendsTale Dec 15 '18 at 07:17 AM

Does the GetControlledPawn node in your picture also make it fail? Like Nebula said, we don't know what your character inherits from, and so far it seems like it's an inheritance issue.

Casting will only work if your "CH_WareHouser_CHAR" is a child of "Character".

avatar image 0r4cl3_My-SQL Dec 15 '18 at 12:36 PM

I´ve tried (it weas first thing which was there but it doesn´t work at all), CH_WareHouse_Char is normal Chartacter blueprint so it should or not? Originaly it was Pawn but I need Character Movement componenets and other things which are in Character Blueprint. Character looks like this or his blueprint

char.png (341.9 kB)
avatar image aNorthStar Dec 15 '18 at 01:26 PM

I'm a bit puzzled, if you are in your custom Player Controller... Get Player Pawn, Get Player Character, and Get Controlled Pawn should work... sorry, I don't have an answer...

Just a side thought from looking at your BP though... once you have the cast working... do just ONE cast in BeginPlay and assign the result to a "Player Character" variable. It is more efficient than casting each time you need a reference on Tick

avatar image 0r4cl3_My-SQL Dec 15 '18 at 01:44 PM

yeah but when I don´t have working cast then it´s for nothing basicaly... :/ if you want I can upload my project to Google drive for example and send it to you so you can look on it on you PC :D :)

avatar image 0r4cl3_My-SQL Dec 15 '18 at 04:49 PM

ok I found it, I had bad world settings for default Pawn Class, but I still have problem character turns, but I can´t move

(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