Control nodes do not respect anchor settings when window is resized (likely result of Camera2D usage)

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

I’m trying to keep some Control nodes in the corners of the window, yet when I resize it, they don’t move and get cropped out of view (or alternatively don’t expand outwards to match a larger window size).
Here’s my tree:
scene tree

I’ve tried adding this to the Camera2D’s script within _process():
get_viewport().size = OS.get_window_size()

I’ve also tried setting the UI rect_size to equal the Camera2D’s get_viewport().get_visible_rect().size, and doing the same procedure (but targeting the UI node, not the Camera2D) for the Velocity Display and Cursor Info nodes.

The anchor values on the labels are actually a little strange, to be honest. I’ve got them set for -.4 on the Y-axis and .4 on the X-axis. In my head that means they should be located at -.4 * (screen_height) on the Y-axis relative to the Velocity Display react. Yet they correctly display inside the window (as long as I haven’t resized it from the project setting).

Here’s an image of the app at the project default of 1920x1080:
default res

And one where I’ve resized it in the vertical axis slightly. Note that the CursorPos and X-Velocity labels are no longer visible. Resizing horizontally does something similar.
modified res

If anyone knows what I might be missing, I’d appreciate some guidance.
An up-to-date (as of this post) version of my project is located here:

are you using “Layout->Full Rect” on the control nodes?

rakkarage | 2020-06-28 00:51

try putting root control node outside of the camera2d node, as the position of the camera2d node may be affecting the positioning of the control node (just a blind guess)

dustin | 2020-06-28 16:01

:bust_in_silhouette: Reply From: p7f

Your gui should not be child of your camera. It should be child of a CanvasLayer for example.

Precisely the answer, I read it somewhere else and hadn’t gotten around to resolving this Q. Thanks

DDoop | 2020-06-29 04:13