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"

Widget vs UserWidget

I'm having some difficulty with the differences between widgets and user widgets. I have a custom control that I would like to both be able to place through the designer and create/place dynamically.

If I make the control a Widget, I can place it through the designer but can't create it dynamically (the Create Widget node seems to require a UserWidget type as does the native CreateNewWidget). If I make the control a UserWidget, I can create it dynamically but it no longer displays as available in the UMG palette to place through the designer.

A possible work around is to make it a widget and create a user widget that wraps but that seems, quite honestly, dumb. In that case, either every access to the control must break the encapsulation of the wrapping UserWidget or the UserWidget must duplicate the control's API as boiler plate pass through functions. Neither is a path I feel particularly happy with.

Product Version: UE 4.19
more ▼

asked Jun 14 '19 at 02:00 AM in Using UE4

avatar image

1 2 3

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

1 answer: sort voted first

I assume you use C++, considering you even talking about difference between the two.

UWidget is a single widget which can contain single Slate widget or Slate composition of widgets. UWidget can't contain composition of UWidgets, they can parent UWidgets and layout them via Slate layout widgets, but it can not compose them ferther then that.

UUserWidget main different is that it can contain free composition of UWidgets. It's a class that widget blueprint generates, your ability to edit widget composition in it comes exactly from UUserWidget class, thats what this class is all about. Also as you noticed UUserWidget are only class that can be displayed on viewport. Keep in mind UMG was made mainly for blueprint use, so to not confuse people it forces you to use Widget Blueprint, even thru Slate that it's basing on let you use any widget class anywhere. UUserWidget got also other benefit, it's only UMG class that is blueprintable to widget blueprint (you need to pick the class during making blueprint class, UE4 will dedect that and create Widget Blueprint instead), is easiest way to do communication between C++ and widget blueprint.

So in general the way UMG works is you place UWidgets in to UUserWidget and place it in view port. If you ask me if you want to make a widget in C++ use UWidget and use Slate in it, because it a lot easier to declere widgets in Slate in C++ then to do so in UMG, while create UUserWidget only to make widget bluerpint inherent from it and use it if oyu need to communicate with your bluerpint widget form C++ via implementable events, you can also make UWidget variables in it to communicate directly to widgets in UUserWidget, but it better to do event that editing of widget themselves are done in blueprint code.

more ▼

answered Jun 14 '19 at 03:52 AM

avatar image

37.3k 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