How to get widget component owning actor?

my interactable actor has a widget component with a button, and when I click the button, I want my player to move to a location which is a scene component to the same actor.

but I can’t get a reference to the owning actor from the widget, or to the specific widget from the actor, or even cast to them.

(none of these work)

how could I do it?


Give this a try. Call to the ‘Event Construct’ and get your player character at index 0 and right click that blue value and set as variable, name it owner. Now on your button click use that other set of code and hopefully when you click it it’ll know the owner.

1 Like

I was trying the other way around, getting a reference to the widget from the actor blueprint, which wasn’t working either, but then what I did was on begin play to create the widget, save it as a reference, and then replace my widget in the widget component with this reference. It worked, but it’s kinda lame.

then I found out this node “get user widget object” which will return a reference to the widget in the widget component. I was using “get widget” which doesn’t work.

now I have a reference to the widget within the actor blueprint and I can cast an actor self reference into the widget and communicate between them. it works fine

cheers

1 Like

Thank you so much for this, your blueprint logic is useful.