x

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 fails on client but not server (UMG)

alt text

I am doing the following within the Event Graph of a Widget Blueprint.

The cast is failing on my client but not the server.

Anyone have any ideas why?

Product Version: UE 4.8
Tags:
failingcast.png (121.8 kB)
more ▼

asked Jul 09 '15 at 02:29 PM in Blueprint Scripting

avatar image

erebel55
380 41 45 65

avatar image Enlo Jul 09 '15 at 02:34 PM

When working with UMG, use Get Owning Player instead of Get Player Character[idx=0].

avatar image erebel55 Jul 09 '15 at 02:42 PM

I tried using Get Owning Player but that gives me a warning when trying to cast. Should I be getting the character from the player somehow?

I also tried Get Owning Player Pawn by itself but that gives me the same cast error as the original.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I'm not at my computer right now so I can't test it myselfe but try "get owning player pawn " instead of get player and use a small delay right after your event execute :)

more ▼

answered Jul 09 '15 at 03:14 PM

avatar image

gloim
169 4 9 21

avatar image erebel55 Jul 09 '15 at 03:15 PM

There is no such thing as "get owning player character"

avatar image gloim Jul 09 '15 at 03:18 PM

Owning player pawn I mean, sry fixed it :)

avatar image erebel55 Jul 09 '15 at 03:23 PM

As mentioned in my comment to Enlo, I tried Get Owning Player Pawn but it still gives the cast error. I will try adding a delay though.

avatar image erebel55 Jul 09 '15 at 03:26 PM

The delay fixed the error. Is that really the best way to do it though? Seems very sloppy.alt text

failingcast.png (111.8 kB)
avatar image gloim Jul 09 '15 at 03:27 PM

Yeah the delay was my main thought ;) but if you work in widgets try to use the "get owning" nodes, it's really handy

avatar image erebel55 Jul 09 '15 at 03:29 PM

Why do I have to manually put a delay in though? And what if the delay isn't long enough for some computers? It seems very sloppy. Shouldn't it just know not to try and cast until after it has gotten the thing to cast?

avatar image gloim Jul 09 '15 at 03:53 PM

well that depends on where you create that widget. i guess it was on begin play on a controller or something like that? simply put you were casting to something that didn't exists at that moment.

avatar image erebel55 Jul 09 '15 at 03:56 PM

Yes, I'm creating the widget in my HUD blueprint on BeginPlay.

alt text

hudgraph.png (77.2 kB)
avatar image gloim Jul 09 '15 at 04:39 PM

Well there are 3 ways to solve problems like this, from worst case to best: 1. a loop until the pawn is valid 2. a delay 3. with the "post login" node in the game mode bp

(comments are locked)
10|2000 characters needed characters left
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