Label control jumps to left side of the screen when instanced inside another scene

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

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?

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.

Ertain | 2019-05-18 18:46

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.

Alexey Gorovoy | 2019-05-20 09:14

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.

Ertain | 2019-05-20 15:40