Having difficulties to make UI

Hi, I’m trying to make a UI with 2 sub UI, at first I was creating scene and import them in the main UI scene but I’m trying to do it with importing node object.

I have two node object, the first one is an avatar with a border and a size of 300/400 to keep it’s ratio


The second is some label organized in HBox and VBox but no size defined

And at last I’m trying to import the two of them in a main UI

But I want for the HBox of this UI to be 100 pixel and not more, but it adapt to the max size of the avatar. And if I adjust the scale it scale down the labels too.

How can I make it?

With 0.5 scale:

What I want without changing the pixel size of each element:

But in this case I changed the Avatar height to 100px, I want it to auto change it’s height with its container height

A Control node size can’t go lower than the minimum size of its children. If your avatar minimum y size is 400 px you can’t make a Control parent be smaller than those 400 px.

You’ll need to change your avatar Panel to be a PanelContainer so it will automatically adapt the size of its children and you’ll need to play with the TextureRect.expand_mode and TextureRect.stretch_mode so it grows or gets smaller with the panel.

Then you’ll be able to make rows whatever minimum size you want.

1 Like

Thanks @mrcdk, it works. Didn’t know that PanelContainer existed!