I’m adding a UIMage to the WidgetTree RootWidget for a custom cursor class using UUserWidget. While this works and the design view show the image the Hierarchy view that lists the widgets continues to show the Canvas panel that is automatically added.
In the UMGEditor the hierarcy view is managed by a WidgetTreeView but I can’t tell how to tell it to update it’s view of the items in the UUserWidget.
I override the RebuildWidget likes this:
if(MyImage == nullptr)
{
MyImage = WidgetTree->ConstructWidget<UImage>(UImage::StaticClass(), TEXT("CursorImage"));
WidgetTree->RootWidget = MyImage;
if(IsDesignTime()) {
WidgetTree->SetFlags(RF_Transactional);
WidgetTree->Modify();
}
FName DefaultText = TEXT("Default");
SetCursor(DefaultText);
}
return UUserWidget::RebuildWidget();
If a default texture has been set it even display in the design view. Just can’t get that menu on the side to update.