Due to issue UE-16764 it’s impossible to inherit a parent’s widget to compose a child widget with some specific element.
What is, currently, the best approach to compose a widget-based HUD? (In the question when I write HUD I’ll always mean “widget-based HUD” to differentiate from specific widget elements)
The possibilities I find at the moment are:
replicate everything. Mostly unfeasible.
create a super-parent HUD containing references to ALL the possible widgets; the child HUDs inherinting from it will set specific widgets to the base class references. Possibly chaotic, still yet to test, it could even not work.
for UMG widgets, i recommend using a hierarchy of composition instead of inheritance.
you can make all widgets inherit directly from UserWidget, and any complex widget that you want to reuse its functionality, can be made out of simpler custom widgets.
so you can create atomic scale widgets, which each do 1 basic thing, like text labels and icons, then you have molecule widgets made of those labels and icons, then you can have larger molecules made from those smaller molecules, which can be called Cards, then you can have menu widgets, which are lists of cards added to scroll boxes with selection logic, then you have page widgets that describe a layout of menu widgets and cards. then at the top of the hierarchy of widgets would be a MenuManager widget, which decides which page should be open.
all of these widgets should inherit directly from UserWidget, and if you do it right, breaking complicated widgets into simpler parts, any part of a widget you would want to reuse, should already be a separate part, so you don’t need inheritance.