how can i cast to the exact character that is controlling the widget
(MULTI PLAYER)
Yes casting is mess in unreal
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