0 votes

I just made a new Godot project and created a Label with text. Even with Align: center the text stays top left when I run the game.

edit: alright I solved it, Top and Left margin of 100, but still not centered

in Engine by (12 points)

2 Answers

0 votes

The label should center within its width. So, for example, if you anchor the label to the right and left of its parent with zero margin, the label will be centered inside the parent.

Try scaling up the label's width considerably, and see if it centers the text within its width. Be sure to remove your 100 margin.

by (91 points)
0 votes

Place it inside a container, Margin, Panel, Hbox, Vbox, are good options.
Then in the label's size flags, unmark "fill", in both horizontal and vertical, and mark only keep centered in both. (Don't confuse align parameters from label's text one with the one you should tweek, the every control 's size flags.

Option two, place it in a center container, and make sure fill and expand size flags are not marked.

by (322 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.