UUserWidget::NativeOnInitialized does not initalize the extention because it has not been added yet. UUserWidget::AddExtension does not initialize the extention because bInitialized is set after NativeOnInitialized has completed. Broken! Adding the extension before call to Super::NativeOnInitialized smells.
I think you misread the post. It is not about Construct but UUserWidgetExtension::Initialize, which is not called in the above situation. A workaround is this:
void UYourWidget::NativeOnInitialized() {
Super::NativeOnInitialized();
UYourExtension* Ext = AddExtension<UYourExtension>(); // <-- UYourExtension::Construct() is called here
}
So I did my initialization in UYourExtension::Construct(). But that’s much worse than your workaround. Thanks for pointing that out, I had somehow missed that at the time.
But to be honest, I also still didn’t fully understand the difference between the Construct and Initialize events for widgets yet
Construct is not called there. The Construct method is not the same as the constructor. Different concepts. In the widgets Construct and Initialize have again very different meanings.
It’s ok I wasn’t looking for an answer this post is a bug report . I draw some attention to issues on the forums cause if I write a report on the bug tracker for every thing I find I’ll be 80 before I’m done.
AddExtension calls both, the extensions Initialize() and its Construct() method. It also does that in this exact order which is not what I would expect.