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.
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here