Using UMG in Slate/Tab?

Hello,

Is there a possibility to use UMG widgets with slate’s SNew() macro? I’d like to create UI for an editor plugin and be able just put a widget from plugin’s content folder into the custom Tab.
(Of course I could just use Slate exclusively, but being able to spawn a widget instead would speed up my work by a mile.)

Thanks in advance

I had a similar problem, I ended up exposing a function to blueprint, creating the UMG Widget there and then passing that into my function.

Then in my function I am using the TakeWidget() from UWidget to get it in SWidget form and setting this to be in my SWindow ‘SlateWin’.

void UControlWindow::SetWidget(UWidget* widget) {
	if (SlateWin.IsValid() && widget) {
		SlateWin->SetContent(widget->TakeWidget());
	}
}

This is with a window that I created and happens during gameplay; so I am unsure how this would work for an editor plugin.

Thanks for the reply! Unfortunately (or fortunately) I ended up learning Slate for my plugin. I realized that in order to even try using UMG in Slate (like in your snippet) I’d have to put the .uasset in my plugin’s Content folder and somehow load it with code. Also as I’ve learned with different stuff, the Editor obliterates any existing UObjects upon Blueprint recompilation, so the widgets would get killed constantly.
As I don’t have time to check whether your code would work or not in my case (and my intuition tells me it won’t due to that BP recompilation stuff), I can’t really mark the question as answered. However I will do so if someone in the future comes along and confirms it can work this way.