Confused about UI Containers and Scaling

Godot Version

4.7.1

Question

I am having a hard time understanding how scaling works within Godot Control nodes. Here is the scenaro. I am attempting to build a game where the player plays cards. I have created assets and they are sized at 375x525. I have created a Card scene to handle the display of the card. Here is the hierarchy of the card.

± Card [Control]

|-- AnimationPlayer

|-- CardImage [TextureRect]

The card node is set with a layout to full rectangle

The card image is also set to full rectangle.

The Card scene is nestled into a CardManager scene which is like the following:

± CardHolder [Control]

|-- HBoxContainer

|------ CARD1

|------ CARD2

Finally this is used in my main game loop scene and anchored using custom anchors to left 0.2, right 0.8, top 0.7, bottom 1.0

I cannot determine why at times the cards scale correctly, but touch anything about the card scene and suddenly it positions the cards in odd places and unscaled in any way.

I have watched videos and read the documentation, but no matter what I do I cannot figure out how to make this consistent. The rest of my logic is working (drawing cards, placing them into the card holder, rendering the cards dynamically, etc.) I’m at the point where I just need to be able to see the cards clearly so I can guide the player through selection and then playing the card.

Any guides, tutorials, whatever will help. I’m just stuck and frustrated at this point.

BTW, coming from 25+ years of web development, so if there are concepts there that translate that can help as well.

Thanks!

Containers control their children position, scale, and rotation setting them whenever they detect a change to them or their children. You can use Control.offset_transform_* properties to change it visually without affecting the containers changes. More info: