How to tell the editor to update the hierarchy in UMG ?

Hi everyone,

I’m trying to make a custom UserWidget with pre-built WidgetTree. It seems everything needs to be done in the :

  • MyUserWidget::RebuildWidget

The thing is, I see my UWidget in the editor :

But not in the Hierarchy :s Here is my code :

TSharedRef<SWidget> UProjectButton::RebuildWidget()
{
	UPanelWidget* pRootWidget = Cast<UPanelWidget>(GetRootWidget());

	if (pRootWidget == nullptr)
	{
		pRootWidget = WidgetTree->ConstructWidget<UCanvasPanel>(UCanvasPanel::StaticClass(), TEXT("CNV_Main"));

		UCanvasPanelSlot* pSlot = Cast<UCanvasPanelSlot>(pRootWidget->Slot);
		if (pSlot)
		{
			pSlot->SetAnchors(FAnchors(0.f, 0.f, 1.f, 1.f));
			pSlot->SetOffsets(FMargin(0.f, 0.f));
		}

		WidgetTree->RootWidget = pRootWidget;
	}

	TSharedRef<SWidget> widget = Super::RebuildWidget();

	if (pRootWidget && WidgetTree)
	{
		pMainBorder = WidgetTree->ConstructWidget<UBorder>(UBorder::StaticClass(), TEXT("BRDR_Main"));
		UPanelSlot* pBorderSlot = pRootWidget->AddChild(pMainBorder);
		if (pBorderSlot == nullptr)
		{
			UKismetSystemLibrary::PrintString(GetWorld(), TEXT("ERROR : Border Slot not binded !"), true, true, FLinearColor::Red, 10.f);
		}
	}

	Super::SynchronizeProperties();

	return widget;
}

And I need these availables for my designers.

I know that the question has been asked 3 years ago : C++ Adding Widget to WidgetTree doesn't update Hierarchy view in editor - UI - Unreal Engine Forums

But I think no one will answer them.

So just, how can I make my C++ created widgets available in the Editor ?

PS: Ah and when at runtime I’m looking the WidgetTree with “UWidgetTree::GetChildWidgets(GetRootWidget(), children);” I see my widget of course

Best regards everyone,

Alex

Did you ever find out how to get c++ created UWidgets to show up in the Blueprint Designers Hierarchy?