Hello everyone, so I’m currently working on a building system and I want to add, so the player can interact with some build pieces and change settings like light strength
but I ran into a problem, if I make a child Widget I can’t add new widget parts like buttons and checkboxes without the parent being removed
Widgets do not inherit hierarchy (kind of), only vars and functionality. Add a Named Slot to the widget base class, you can then drop any widget into that slot:
Use the base class widgets and give their slots something to hold:
This can be done dynamically, too. This way you have the visuals of the base, its funcionality intact, and additional unique functionality and visuals of the user widget. And nothing stops you from nesting things deeper and making the layout more modular.
Takes a while to get used to working like this. Sadly, the original plans of widgets inheriting stuff normally, like actors do, never materialised.