Hello @Antidamage I actually was doing the same 2 weeks ago. I wrote this example: lets asume you want to create a new SWindow and use a UMG widget inside of it:
void CreateWindowFromUMG(UWidgetBlueprint* Blueprint)
{
if (!Blueprint) return;
//~ Gets actual widget class from the blueprint
TSubclassOf<UEditorUtilityWidget> WidgetClass = Blueprint->GeneratedClass;
//~ We need da world
UWorld* World = GEditor->GetEditorWorldContext().World();
check(World);
//~ Create widget
UEditorUtilityWidget* CreatedUMGWidget = CreateWidget<UEditorUtilityWidget>(World, WidgetClass);
if (CreatedUMGWidget)
{
//~ Create Slate window
TSharedPtr<SWindow> EditorTab = SNew(SWindow)
.AutoCenter(EAutoCenter::None)
.Title(FText::FromString("my win"))
.IsInitiallyMaximized(false)
.ClientSize(FVector2D(300,300))
.SizingRule(ESizingRule::UserSized)
.SupportsMaximize(true)
.SupportsMinimize(true)
.CreateTitleBar(true)
.HasCloseButton(true);
//~ Add Windows to slate app
FSlateApplication & SlateApp = FSlateApplication::Get();
SlateApp.AddWindow(EditorTab.ToSharedRef(), true);
//~ Use UMG in slate
EditorTab->SetContent(CreatedUMGWidget->TakeWidget());
}
}
if you want to use the path to your asset like in your example, I suggest you to use FAssetData instead, it is easier.
Cheers!