How to dynamically create a UImage and add it to a VerticalBox container?(runtime, c++)

I use the api:

UImage* NewImage = this->WidgetTree->ConstructWidget(UImage::StaticClass());

VerticalBox->AddChildToVerticalBox(NewImage);

It seem OK, But when I exist the PIE(Play In Editor),Unreal Editor crash.

I try to use API: removeChild to release NewImage ,no change…

can you give me some advise, thanks~

maybe you should use “UImage* NewImage = NewObject(this, UImage::StaticClass());”

I have tried this API(New Oject), but the problem remains the same.。。。


I use this code, no crash

Oh,no,It’s still the same here。。。