I updated my system to auto-propagate the controller to each UAuraUserWidget child. With this simple change, we can just set the controller on the top-most widget (such as the Attribute Menu or OverlayWidget ) and it propagates to all the children. You no longer need to manually set in the blueprint for each sub-widget. Saves time and eliminates errors. I'm lazy. 😉
void UAuraUserWidget::SetWidgetController(UObject* InWidgetController)
{
WidgetController = InWidgetController;
WidgetControllerSet();
// Propagate the controller to each UAuraUserWidget child of this widget.
// They in turn will propagate the controller down, so we only need to set
// for the top-most widget.
WidgetTree->ForEachWidget(
[&](UWidget* Widget)
{
if (UAuraUserWidget* AuraWidget = Cast<UAuraUserWidget>(Widget))
{
AuraWidget->SetWidgetController(InWidgetController);
}
});
}