Custom Minimum Size is being ignored

Godot Version

4.1 Stable

Question

I have just started looking into how user interfaces work in Godot 4.1. I have created a button control node and have tried giving it a custom_minimum_size of 400 pixels on the X axis in the Inspector > Layout section however when I run the scene and adjust the screen size down to 200 pixels I am finding that the button just ignores the custom_minimum_size entry.

How can I get this to work?

For context, the button is a child of a control node named dialogue_ui which has no custom_minimum_size entries.

Are you resizing the actual game’s screen size? If so, your control nodes get scaled per default. To achieve what you want you’d have to disable scaling in Project/Project Settings/General/Display/Window/Stretch/Mode = disabled

This would mean that your Control node’s settings will never scale with the game’s window size automatically. But you would need to implement something for the players to adjust your game’s UI for their individual needs. Or just rely on one resolution always. Is that what you want?

2 Likes

I am simply wanting to limit the minimum width size of the button on the X axis to 400 pixels so it does not shrink any lower than that, as per this video: https://youtu.be/5Hog6a0EYa0?si=MVAN-W-yZ2s7-AQm&t=551

I followed the video as closely as I could but my custom_minimum_size entry for the button is disregarded as when I play the scene and then use my cursor to shrink the game’s screen size the button adjusts itself down to 0 pixels rather than the 400 pixels I set.

Check your project’s setting as described above please.