Widget Component - Get parent actor?

The Widget Component is housing a regular widget. We extract it from the component and create a direct reference.

Remember this bit?

No, afaik the widget does not know
it’s sitting pretty inside a
component.

The opposite is true, though - the component knows which widget it has. Rather than Get User Widget → Cast every time we need access, we do it once at Begin Play and store the reference so it’s easily accessible from then on, according to this:

it’s much easier to access an actor
that has calculated data than pull
that data out of a field of a widget
embedded in a component…


One way to create a reference quickly: right clicking on the pins and Promote to Variable - this will create a reference variable of the correct type. You can now use that variable to access data of any object it points to. In this case - the widget that was embedded in the component.