Cast fails on client but not server (UMG)

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?

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

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.

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 :slight_smile:

Owning player pawn I mean, sry fixed it :slight_smile:

There is no such thing as “get owning player character”

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

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

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?

Yeah the delay was my main thought :wink: but if you work in widgets try to use the “get owning” nodes, it’s really handy

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.

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

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