communication between actor and widget



Hi
What is the best way to communicate between these two? is it possible by just casting or do I need interface or blueprint component?
The pictures show that I don’t know what to plug while casting to BP_Sword.
I basically want to set the interact widget visible when I overlap with the sword collision sphere.

Set the InstanceEditable and ExposeOnSpawn flags for the BP_Sword variable in widget. A pin will appear in the CreateWidget node through which you can set the variable value in the widget. Connect the Self node to it.

After this you won’t need Cast in the widget, your variable will be initialized with the value passed when creating the widget.

1 Like

That really depends on how many widgets communicate with how many actors.
Or TLD/DR: do you want everything just work or be modular and same code that handles it all around.

For just one widget to one actor. Keep actopr reference in place like character BP or HUD bp (somewhere easy to get reference from widget). Then either read variable directly or hook to dispatcher that updates it.

1 Like

thank you guys!