Access to Blueprint subwidgets from C++

I want use logic of GUI in C++ and construct forms in Blueprint.

For this, I must declare subwidgets in main widget class in C++ code.

And in blueprint I must define this widgets for placement and other operations.

How to do it? The declared in C++ widgets cannot be placed to widget hierarchy in “Designer mode” of Blueprint.

Did you find any solution to this? I’m having the same issue…

I used WidgetTree->FindWidget(“WidgetName”) method on widget context.

And this C++ widget (inherited from UUserWidget) must have blueprint child. After all we can write C++ logic and plcing UMG widgets manually.

Widget can be created in C++ using CreateWidget<UMyWidget>(GetWorld(), MyWidgetClass) where MyWidgetClass is blueprint TSubclassOf<UMyWidget>

see my answer :slight_smile: