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
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.
answered May 08 '16 at 04:28 PM
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
answered Aug 08 '15 at 09:40 AM
still can't derive from Widget Blueprints properly in 4.10
but I might have found another dirty workaround:
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.
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
2) Create a
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.
answered May 08 '16 at 05:08 PM
I guess best solution for this would be to use Interfaces :)
answered Oct 04 '16 at 12:14 PM
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:
So although you cant reparent them, it will not work as imagined :(
Nesting and interfaces seems to be (still) the way to go.
answered Feb 01 '17 at 10:31 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here