Difference between control and container nodes

Godot Version

4.5 Stable

Question

looked through the documentation but it confused me more, from what I understand both have to deal with scaling and position labels and other UI elements. However, I don’t quite understand the functionality of both and why I should use them in my UI.

Control is the base class for all UI elements. It can display something (Label, Button, TextureRect, etc.), it can receive input, and it can be placed anywhere.

Container is a special type of Control that automatically positions and sizes its children according to specific rules.

So, for instance:

If you put three Buttons inside a Control (e.g. Panel), they stay exactly where you place them.

If you put three Buttons inside a HBoxContainer, they automatically stack horizontally, resize properly, keep spacing even, and adjust if the window is resized.

4 Likes

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