Inheriting Widget Blueprints

The ‘pick parent class’ menu does not show up when you make a new widget blueprint, but you can still go to Blueprint Props and reparent it from a drop down menu. However, after doing this, the widget designer content is STILL EMPTY. And now, when i use the child widget in place of the parent one, nothing shows up. Using the parent one shows up fine. All i wanted to do is override some functions in the child, not even change the design. Adding a sizebox and adding the original inherited variable widget to it as a child also does nothing.

How do you properly inherit Widget Blueprints ?

engine version 4.6 preview

I am seeing the same thing. Will there be a way to do this in the future? I’m on 4.7 Preview Build at the moment.

1 Like

same problem here…

1 Like

I would like to know as well (doesn’t work with 4.9)

1 Like

Actually… trying to reparent anything at the moment in 4.8.1 causes an instant crash on my side. I can create a widget from an existing one but it won’t show up in the “user created” list.

bump this. I’m trying to do the same thing for swapping out images that we use for text localization (stylized font only uses English letters, so we had to do everything with images). I was able to change the parent class and I binded all of the images to texture2D variables. The variables show up in the graph for the child, but nothing shows up in game when I try to create the widget and add it to the viewport.

If any of you guys have had luck or know of a workaround, please let me know. If I find a way to make this work, I’ll do the same. Thanks

1 Like

So here is what I got to work for mine. I’m not sure if this applies to your situation or not.

I created the regular UMG for our Main Menu and set up all of the functions that controlled the button presses and other options that the player can select in the UMG. I then created a second UMG and instead of using the drop down for the parent class, I deleted the Root Panel and then dragged the original UMG for the Main Menu onto the canvas from the “user created widgets” section on the left hand side in the designer palette. I was then able to access all of the functions from the original Main Menu UMG. For the items that I wanted to change out, in our case the text images that I am using for the different languages, I binded the images to a Texture2D variable. On EventConstruct in the second UMG (the one I wanted to make the changes to) I grabbed a reference to the pasted Main Menu UMG and set the specific images there. Changing out the different UMGs was quite a task, but I am able to swap between the two UMGs by selecting a language from the Main Menu.

I hope this helps in some way. If you would like, I can take screen shots of any of the parts of the process or UMGs that I am using

Is this really the canonical way to derive a UMG blueprint from another? Sounds more like a workaround to me.

The reparenting in the File menu works now in Version 4.9 but still, when I show the widget screen, nothing shows up, it is as if there was no cahnge in parent class at all

1 Like

Same problem here, the function and variables can be inherited but WONT display on the Variables panel (You can get variables and call function by code).

BUT, the Design never inherited

1 Like

still can’t derive from Widget Blueprints properly in 4.10

but I might have found another dirty workaround:

  1. Make a duplicate of the original Widget Blueprint
  2. Change the parent class of the duplicate to the original you want to inherit from
  3. Witness loads of error spam about already existing functions and variables
  4. Repeat steps 5-8 for all functions:
  5. copy the graph (without the function-enter node) AND memorize where the inputs connect
  6. delete the function (in the functions list)
  7. override the function
  8. paste the function graph and connect inputs and exec chain
    9… Rename all the Elements in Designer which are also variables
  9. Replace all references to those elements in the Graph
  10. compile and enjoy

It’s strange that the inherited widget blueprint works fine after that (can still edit in Designer) but it doesn’t work at all when you make a new class that inherits from another like it’s supposed to be. Might be a minor Bug that causes major problems.

Bump this! 4.11 (and 4.12 preview) and still no widget blueprint inheritance.

I am forced to duplicate and manually maintain the hierarchy by hand.

1 Like

You can definitely create a widget a child widget when you go to create a new blueprint. Right click in the content browser, select blueprint and then search for the name of your widget class and create new one deriving from it.

1 Like

Well, I just tried this and things seem to be working.

(The trick is to try to create a “Blueprint Class”, not a “Widget Blueprint”)

Edit:
Forgot to mention that the inherited designer is empty and you have to rebuild your UI’s contents.

I tried flip hazard solution, in 4.1, but things broke very often when modifying the “base” blueprint.

My variant for working around this issue in 4.11 is:

  1. Create a MyWidgetBase_BP that contains all of the logic and absolutely nothing in the designer. No components, no child widgets. Whenever the logic needs to reference a ChildComponent, it calls an empty GetChildComponent() accessor method.

  2. Create a MyWidgetDerived_BP, delete every default in the designer, go to the graph, change parent class to MyWidgetBase_BP.

  3. In each Derived blueprint, fill in the designer stuff, child widgets, etc. Override all the inherited (empty) child component accessor methods to return whatever you put in the designer.

  4. Make sure that no blueprint references components directly, and that all use the (polymorphic) accessor methods.

Voilà! You have now a child class with all the parent class´ logic, ready to override.

Edit:
Try @SuperDuperYeah’s suggestion.

Yep that’s… the only downside. Which you know… I hope would be implemented at some point (getting all your widgets in when creating a child).

I guess best solution for this would be to use Interfaces :slight_smile:

I’m having the same problem. My code is a hideous mess as a result of this and having to manage two dozen duplicate widgets instead of some simple code that just casts back to the parent in order to set variables.

1 Like

UMG Widget inheritance is indeed not possible (according to Nick Darnell). For that to work, the UMG designer would have to be able to merge different widget trees or something…

See here and here:

UMG-widgets

Inheritance

So although you cant reparent them, it will not work as imagined :frowning:

Nesting and interfaces seems to be (still) the way to go.

You can do what you wish and only override functions by starting as you already have - make a new widget, and reparent to your desired parent widget. You’ll see nothing there - but now delete the Canvas Panel object and recompile, and the parent widget will appear in its place. You can then work only in the Graph view and manipulate the parent as you like, but sadly as far as I can tell you are unable to add additional widgets to the Designer view. You could, however, use the Graph to create a widget and add it to an existing panel in the parent.

1 Like