|Topic was automatically imported from the old Question2Answer platform.
In a game I’m developing, I have an action bar which contains a fixed number of buttons and a section where I want to add (or remove) buttons depending on whether an action can be executed at the moment. The bar should expand or contract depending on the number of buttons it contains. So at one moment it might have only two buttons, another moment five, but in all cases, the container should expand. I should mention that this action bar has a background (it’s a panel at the moment) which should also contract or expand.
By default it looks like this:
If I add buttons, right now it looks like this:
As I’m using a VBoxContainer, it just expands to the right, but I want the background Panel to expand too.
This is how I would like it to look (changed size by hand now)
I took a look at the container section of the documentation, and played a bit in the editor, but all I found is how to make the contained elements change size, but not how the container itself could react to its children by changing size. Is this even possible with the standard containers and controls? I want to know that I’m not missing on anything, before trying to implement my own solution.