Parent UI element doesn't adjust to the children elements

Godot Version

4.2.1

Question

Hi! I have a problem with UI.

I have a simple UI tree:

  • Plain container (CharacterInventorySlotsUI)
  • ItemSlotsList (Horizontal container) which contains Control elements

My parent Container doesn’t adjust to the ItemSlotList Control element, it has height 0px:

But when I select ItemSlotList Control child element the height is set to 40px:

My goal is: Parent should take the exactly the same height/width as children elements
Do I miss something or am I using wrong nodes. I tried looking in different UI tutorials in godot, but many ppl set properties by hand, height/width etc. I want the parent to adjust to children

“CharacterInventorySlotsUI” is not a container, it’s a regular control node. Not all controls are containers. You need one that inherits the Container node.

1 Like

Alright, thanks for answering, I’ll check now with container node

Heh, it works, I used GridContainer and parent adjust to its children, thanks for quick answer!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.