Guys I’ve been following a tutorial to build a ThirdPerson game and I cannot cast from a menu Widget to Player Character. Here is how the event graph of the Widget looks like:
Do anyone know why? Thank you!
Guys I’ve been following a tutorial to build a ThirdPerson game and I cannot cast from a menu Widget to Player Character. Here is how the event graph of the Widget looks like:
Do anyone know why? Thank you!
Does the player exist at this point?
Pawn has to exist.
From Controller class… Get Controlled Pawn → Is Valid [valid] → Cast
Hey @yujiaoshou — this is a super common hiccup when working with widgets in Blueprints, especially early on
When you’re inside a Widget Blueprint, and try to cast to the Player Character, your “target” is likely not set correctly.
If you’re using something like Get Owning Player
→ that gives you the Player Controller, not the Character directly.
So if you try:
blueprint
CopyEdit
Cast To MyCharacter (target: Get Owning Player)
…it fails, because you’re casting a Controller to a Character, and they are separate classes in Unreal.
blueprint
CopyEdit
Get Owning Player → Get Controlled Pawn → Cast to MyCharacter
Get Owning Player
returns the ControllerGet Controlled Pawn
gets the Player Character the Controller is possessingblueprint
CopyEdit
Get Player Character → Cast to MyCharacter
If you’re working on a growing project, you’ll hit this casting pattern often — especially when passing data between menus, characters, game modes, etc.
To stay organized, we use a tool we built called Asset Optics that lets us:
It’s helped us a ton with keeping UI logic cleaner across large BP graphs.