C++ Adding Widget to WidgetTree doesn't update Hierarchy view in editor

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.

Did you find a solution for this? I am having the same problem

I have same problem, too :frowning:

That’s my problem too. Please anybody, share at least your thoughts about it.

I have same problem, too :frowning:

I have same problem, any one can help!!!!!!!!!!!1

Maybe because you’re rebuilding the widget after you’re setting everything?

You can editor widget in blueprint.And use WidgetTree->FindWidget() anywhere you want in cpp.

have anyone solve this problem?

I have same problem, too :frowning:

geez still no solution?

Same problem :frowning: