UI scales differently than ground and player

Godot Version

4.3

Question

My UI is scaling differently than the rest of the scene when I playtest, but looks correct during editing.

Example, I have a canvasLayer for my UI, a Characterbody2d for theplayer, and a tilemap for the ground. They all look properly scaled to each other in the viewport, but when I playtest the UI always shrinks.

Ive been messing with this for hours, sometimes with the UI proper sized and the player and ground 3x larger, or vice versa. I’ve tried messing with project settings, different resolutions, making sure everythings scale is set to 1, 1. Nothing seems to be working.

Could you share an example of how you want it to look versus how it looks currently? What settings are you using exactly? Where are your UI anchors set?

Well I tried to post a before and after screens but apparently I cant because im new :confused:

stretch mode is disabled, if i enable the ui will look fine but the character and wall will be large. Im not sure what is meant by UI anchors

Here we go, you can see how the panel in the top left changes scale when running

Anchors are the green pips in your top-left corner, they specify how UI elements should scale relative to their parent (the screen in this case). With the top-left anchors your HUD node is set to never scale, and hug the top-left corner when the screen does change size, I would recommend HUD be set to “Full Rect” in either the properties or through the toolbar here:

Containers help reduce the need for anchors, currently you have a Panel and two Labels all as direct children of HUD, I would recommend changing HUD to a PanelContainer, adding a VBoxContainer as a child, then adding the Labels as children of that like so:

This layout means you only have to worry about the HUD anchors and the VBox will take care of the children’s position automatically stacking them vertically. You can still change some left/center/right/fill positioning of the containers using the dotted green box in the toolbar, usually replacing the preset anchors button.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.