How to find the top level class from widget?

I have a widget that’s a single icon that directly talks to the player controller when it is pressed.

But I want it to report in which menu it is located, ie which blueprint asset in the component browser.

However, when I loop through “get parent” to get to the top, I always only get widgets. I never end up in the object containing the widget.

Is there a way to access that via blueprints?

If you create a parent actor for your blueprint actor and make it a child, then you can cast to the parent anywhere you like and you’ll always have a connection to its children essentially meaning you never need to figure out what the top-level class is because you know.
What exactly are you trying to accomplish?

Get Parent always seems to return a “panel widget” object. But that “panel widget” is always placed in a “user widget” blueprint asset (ie, the button that asks is always placed in a menu). I’m trying to access that bleprint asset, but I don’t know how (ie, the button wants to know which menu it is in).

Oh you’re using widgets inside of widgets? When you said blueprint asset, I assumed a blueprint actor, not a widget. Sorry, I’m very inexperienced with widgets. Maybe post on the forums rather than answer hub?

When i make a widget and want to access its parent i just make a variable in the widget wth a reference to the object (parent). Gotta make it instance editable and expose on spawn and when you create a widget there’s an extra pin, just use “self” in the parent object to hook it up

as argument just send self reference to widget

function return widget in which self referenced widget is present, for ex. I have widget called WB_A, and it is inside WB_B canvas panel, inside border inside… WB_A calles this function giving itself as argument, goes to the top of the hierarchy ad returns WB_B reference and name