Can variables of a widget be shown in the properties of it's parent?

Hi!

So far I made my widgets using child widgets I created. The more nested they are, the more variables need to be transmitted, which can get tiresome. Therefore I wonder whether a widget can show the properties of one of it’s children in the properties of the widget itself.

Example: Let’s say I have a menu, that has a custom button widget in it. This button widget consists of a button and a custom text widget. That text widget only uses a single text block.

Right now, the text in the text block from the text widget is set by a variable in the text widget. The variable of the text widget inside the button widget gets set by another variable in the button widget. What I want is to set the variable of the text widget directly using the properties panel when editing the button widget inside the menu widget. Is that possible?

Thank you in advance!

Two options that could work well, depending on what’s really needed.

  • by default each user widget is of User Widget type but can be reparented:

314424-reparent.jpg

In this case you’re working with inheritance and a child can access its parent’s methods and variables.

  • you can store data in a container and grant pertinent widgets access:

314425-screenshot-2020-09-21-085857.jpg

You do not need to use an actor as a centralised data source, this works well:

314427-screenshot-2020-09-21-090232.jpg

Once you hook it up, the widgets pull data from the asset.

Widget property binding also works well with nested structs.

Thank you! I didn’t expect a solution so quickly.

I never heard about data assets before and I’m still confused after trying to use them. But I’ll figure it out. :slight_smile:

You can absolutely use a regular actor for this, especially if the menu needs extra functionality - like timelines, or handle other components or be 3d. The extra functionality of an actor manager can be handy at times.

You could utilise the HUD class for this. Especially considering how easy it is to access - since it’s a framework class.

And once a widget gets access to an actor or an object, you can bind its properties:

The downside is that you need to provide each widget with a hard reference - but that’s 1 variable rather than dozens or hundreds. Not really an issue for something like a main menu, though.