First of all u need to create root widget with Init function. It wont work other way, if u need visual part of widget to be visible in Widget BP Editor u need to use NativePreConstruct(), then u can see the changes after every compile, NativeConstruct() arent working in the editor.
-h
virtual bool Initialize() override;
-cpp
bool UWIDGET::Initialize() {
bool RESPONSE = Super::Initialize();
if (!HasAnyFlags(RF_ClassDefaultObject)) {
BODY = WidgetTree->ConstructWidget<USizeBox>();
WidgetTree->RootWidget = BODY;
}
return RESPONSE;
}
and don’t try to add other widgets to rootwidget in Initialize function , it will crash the editor, setup root widget in Init and add other stuff to it in NativeConstruct() or NativePreConstruct(), also u’ll probably wont see all ur stuff in widget tree in bp editor, just result of compilation in preview window, u need to register those elements somehow to see them in BP editor widgetree, but i don’t know how.
here’s the way u add slots
SPACE = WidgetTree->ConstructWidget<UCanvasPanel>();
auto BODY_SLOT = BODY->AddChild(SPACE);
no need to Cast like u did.
Peace.