UIExtension get widget reference after registering it

Yes, it can be done.

You need to define a new type of UObject which will be used to ‘configure’ the extension point. The way it works is tricky. You access the UI Extension Subsytem from BP, then you use Register Extension (Data /for Context) , and use Construct Object node to create a class of your custom UObject data type. Pass that constructed object as the Data parameter.


If you use a version with context, you need pass a Local Player object as the Context object parameter. This is for multiplayer games where widgets need to be player-specific.

In the UI Extension widget details panel, in UI Extension subcategory, you will need to register your UObject data type as an entry in the Data classes array. Then, finally, you need to bind both provided delegates:
image

The ways these delegates work is Get Widget Class for Data receives your custom UObject data type, which allows for discriminating for a Widget class.

Configure Widget for Data receives an instance of that class and also the UObject data type which can then further be used to customize the widget.

This solution is obviously for configuration at init time. For update during runtime, use an event dispatcher.

2 Likes