UI Not Centered When Window Is Scaled

Hey there! I’m currently working on a project called Render. It’s a puzzle platformer game. How do I make it so the UI stays in place when you scale the window? When I scale the window, my platformer character will always stay in the middle, because there is a Smooth camera behavior attached to it. But my UI that is on a separate layer will just always stay in the same place. It only works in full screen at 1920x1080 resolution. When we scale it to the side, the UI doesn’t snap to the edge/corner like it should.

Here’s a photo example I put together. In the top left, you can see the main game in fullscreen, and on the top right, the main game out of fullscreen. the spacing is ruined when I go out of the screen, because fullscreen is exactly 1080x1920. You can see another example of this on the bottom left and bottom right with my current menu scene.

As you can see there’s weird spacing issues when we exit fullscreen. I’ve had this issue with another project I’ve been working on, and it’s pretty annoying, so I’d love to know how to fix it.

Thanks in advance.

The anchor behavior can help you with that! It allows you to anchor UI elements to the borders of the window, so that they move/resize with the window size.

Anchor behavior is option A
Option B is CameraWidth()/2 CameraHeight()/2
To set something in center

For sticking to borders you go with
CameraBorderLeft() +10
CameraBorderTop()+10
CameraBorderRight() -10
CameraBorderBottom() -10
10 is just example you need to adjust it for your needs