How comes my Control is center at its left corner?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gokudomatic2

I made a form with controls (buttons, line editors…) and I want to center it in my screen. I tried to create a Container control with a fixed size and to put all my elements in this container. And then I set the layout of the container to centered full height, but it aligns my container as if it didn’t have any width:

I use only controls, so there’s always a width and height. How to force godot to align my container on its true center?

:bust_in_silhouette: Reply From: juankz

You can use a center container and set the archor property too FullRect. And if you haven’t, also use VBoxContainer and HBoxContainer to align items in your form, those containers are very useful.

Here is a video explaining this in more detail:

Interesting indeed. But I also found another way, maybe a bit easier. If I manually correct the offset after I aligned the container, it is taken in account when the window is resized. With some try and error I could find the right offset to keep my container centered.

Gokudomatic2 | 2018-06-02 09:20