CASTING TO WIDGET OWNER ๐Ÿ˜(MULTI PLAYER)

how can i cast to the exact character that is controlling the widget
(MULTI PLAYER)

Yes casting is mess in unreal :smiley:

I usually do that stuff (widget communication) in one of those ways:

first tell widget who the boss is:

  • make event in widget child: Event_SetParent (you may use blueprint interface)
  • in that parent make array of all widgets you want communicate with
  • then in for each loop call that EventSetParent, and tell child widgets what is parent pointer.
  • so all childโ€™s have exact pointer to their own parents.

second way is communicating trough some persistent blueprint like game mode, game instance, the hud, or player controller.

  • make dispatcher in your master blueprint of choice
  • that dispatcher should be made like message bus (or event bus)
  • make enum that selects type of information, like HP, mana, ammo etc
  • all hud widgets should assign (hook) to that dispatcher
  • then trigger dispatcher with correct enum, as payload use string (you can change anything to string and from string)

am kind of confectioned can you send a pics of how to do it If possible
and i appreciate your help

#1 - This custom even should be created in widget:

#2 - this is creating widget and setting its owner (above event):

#3 - this is how i do for multiple widgets:

So create #1 in your widget.
Then Use something like #2 in player controller (i did that in BP_HUD)

#3 with blueprint interfaces can handle multiple widgets directly.

make sure u create all your widget in your HUD blueprint and just use the node โ€œGet Owning Playerโ€

get owning player would need an object into it i believe

If i was doing step 2 in HUD i wont be able to use self as โ€œMy Hud ownerโ€
so what do you suggest for me to use instead

Hello @Td1 you can just cast to your player like you would in a single player game.Here is a basic example:

Result:

Edit: Widgets are not replicated they only exist locally on the client where you create them. The server will never know about them. @Td1