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"

Make C++ Widget accessible with UMG editor

How do you make an accessible widget for blueprint in C++ ?

Here I'me creating my widget like that :


 // The widget I want to be able to edit in the UMG editor.
  // Maybe a meta ?
  UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
  class UMyWidget * TheWidget;


 TSharedRef<SWidget> UPersoUserWidget::RebuildWidget() {
     TSharedRef<SWidget> Widget = Super::RebuildWidget();
     UPanelWidget* RootWidget = Cast<UPanelWidget>(GetRootWidget());
     if (RootWidget && WidgetTree) {
         TheWidget = WidgetTree->ConstructWidget<UTheWidget>(UTheWidget::StaticClass());
     return Widget;

I want the widget editable as the CanvasPanel in default UUserWidget with UMG editor (The UserWidget inherit from UPersoUserWidget) : alt text

But I can't find where this canvas panel is declared. Maybe a UPROPERTY meta allow this use ?


Product Version: UE 4.18
res.png (78.1 kB)
more ▼

asked Mar 18 '18 at 01:55 PM in C++ Programming

avatar image

131 3 6 15

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

1 answer: sort voted first

You implmenting widget in wrong way. In order to understand whats doing on here you need to understand difference between UMG and Slate. Slate is UI framework build originally for editor, but can be used in game, but because all classes of Slate operate outside of UE4 reflection system so Slate can't be used in blueprints. Thats why UMG was made, UMG is Slate wrapper for blueprint, yes UMG is not really UI framework on its own, just way to make Slate usable in blueprints with some extra features like animations and layout editor which Slate alone don't have.

UWidget is Slate widget wrapper class, in RebuildWidget UMG expect you do define Slate widget (SWidget) and this is what you should do in RebuildWidget.

If you want to make widget that contains UMG widget, then you make UUserWidget with widget properties with this specifier:

 UPROPERTY(meta = (BindWidget))

someone explained this well here:


If you ask me Slate is a lot easier to operate in C++ then using only UMG, so i think best option to do C++ widgets is to make UWidget (not UUserWidget as this class is made to contain other UMG widget, but if you use Slate you don't use any other UMG widgets) and define slate widgets in RebuidWidget. You can read about slate here:


for example this will create simple text widget:

  TSharedRef<SWidget> UPersoWidget::RebuildWidget() {
      return SNew(STextBlock)

You also need to synchronize Slate widget with your UMG properties in SynchronizeProperties() function

But if you want to make base for Widget Blueprints then you should use BindWidget specifier method insted.

more ▼

answered Mar 18 '18 at 08:06 PM

avatar image

37.2k 936 172 1116

(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