Make a Widget know which BP_Actor created it.

Beginners question:

I have a BP that creates a widget and adds it to Viewport when touched. There are a lot of instances of that BP in my level. All of them creating and adding the same Widget.

I need the widget to read a variable from the BP_Actor that created it.

How can I let the widget know which of the BP actors is created from ?

Any cue? Thanks in advance.

Create a variable of your BP_Actor type in the Widget BP. After you create a widget, set this variable to be the actor that created it.

You have created your actor BP and your widget BP. In my case they’re called BP_My_Actor and BP_My_Widget.

In the widget BP, create a variable (I called it ParentActor) and set its type to BP_My_Actor; make sure to check Instance Editable and Expose on Spawn boxes. Compile and save.

Now when you select BP_My_Widget on the Create Widget node, the new variable will be exposed. Connect Self to it. That’s it.

Thank you Tuerer! I’m trying a different approach.

Added a boolean variable in the BP_xx “I have an active widget”, set to true when creates it.

Then, the widget construct event Gets All Actors of class BP_xx and test all of them looking for the one with that boolean true.

I’d also try your approach, looks more direct and clean, but not sure to understand it. What do I feed that variable with?

Neat and clean. Now I see it I realize I’ve done this before in tutorials. I have a lot to learn and to practice to stop getting stucked with such basic things.

Thank you, Dr. Tuerer. You saved my day.

PS: How can I mark the question as solved and give you credits for your help?

I’ve converted it into an answer. You can now mark it solved.

Glad I could be of help!