This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

When I instance my HUD inside a scene, one of the labels is displayed in the wrong place - on the left side, off the screen. Despite the fact that it's anchored to the "Center Right" inside it's container. "Top Right" doesn't work either.

This is my UI (Control) scene, everything is fine here in the editor:

This is the setup I have created

But when I try to instance it inside my TestScene the ScoreLabel is in the wrong place:

enter image description here

TimerLabel is anchored "Center Left" inside TopDock (and works fine), while ScoreLabel is anchored "Center Right" and jumps to the very specific, but wrong play.

I also tried to do it without a TopDock element, but that didn't now work either, with exactly the same result.

What am I doing wrong here? Why that is happening?

in Engine by (12 points)

Hmm, maybe there's a fill rule that's messing it up? Did you set it to fill and expand? Maybe playing with those properties will give you an answer.

I don't know why it helped, but I just added a Node object under UIRoot and put both my labels inside this new Node. Anchoring to the right side of the screen works now as I was expecting it to work before. I have no idea why it works this way, from what I can gather everything I tried earlier should have worked too.

It could be that, with a regular node (a non-control node), the rules for aligning the control node are different from higher parent nodes. Can't remember the reasons why ATM.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.