Summary
if widget ‘A’ inherited from another widget, adding widget ‘A’ inside a widget and then adding widget elements to its NamedSlot, will result in the widget elments disappearing after saving and compiling (in that order).
Steps to Reproduce
() is the parent class
is adding something in the Designer >> Hierachy tab (outliner)
create Widget1 (UserWidget) [add named_slot1]
create Widget2 (Widget1) [add named_slot2 to named_slot1]
create NewWidget (UserWidget) [add Widget2]->[add Button to named_slot2]
Save and compile (in that order)
results
The Button disappears.
expected
The Button stays.
Comments
After adding the Button to the NamedSlot the Button name will be displayed next to the NamedSlot in the Hierarchy tab. After Saving it disappears.
This doesn’t seem right, does the widget editor allow you to have a widget hierarchy within a parent class that already has a widget hierarchy? This would not compile in earlier versions of UE as nesting hierarchies is not possible
Maybe I misunderstand you here, but I thought that was the whole point of the introduction to inheritance since UE5.0
They showed it in the “Advanced UI Templating Techniques using Widget Blueprints and Materials | Unreal Fest 2022” video on the official Unreal youtube channel https://youtu.be/dSTdAToJ7Gg?t=653
What I meant is that last time I used widget inheritance like that, it was not possible to add widgets to a tree when the parent class also has widgets within its tree (compiler error).
I realize I haven’t tried this specifically with named slots and that I am not aware of any changes to this in UE5. Sorry that was not very helpful
For the past versions I have been creating my widget base classes in c++ (all functionality goes there, no design), exposing properties with the “BindWidget” flags for designers to just fill in their designs. For me that workflow works very well. Of course this does not solve your question but if it’s of any help this is an alternative way to create widget classes with reusable or injectable components properly.