x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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

Product Version: UE 4.12
Tags:
more ▼

asked Sep 07 '16 at 08:04 AM in C++ Programming

avatar image

gryzly123
71 2 8 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Sep 16 '16 at 10:29 AM

avatar image

KnightArchitects
21 3 10

avatar image gryzly123 Sep 19 '16 at 08:36 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question