+1 vote

Hi!

i'm using Godot Engine since few weeks now, and I do appreciate the simplicity of the scenes system in combination with the elegance of GScript, to which I get used with ease.

There is anyway a point I really fail onto: to build a GUI that is completely screen size indipendent.

I understand how 'anchors' and 'margin' work and I tested every of the Control nodes (such as VBoxContainer, CenterContainer, etc...), but when I play with that properties withinh the inspector, it seems that (in some circumstancies) changing the parent propertis affects the children settings and/or viceversa: an annoing reset that make my efforts useless.

I woud like to make a GUI like that:

enter image description here

...and this is what I tried:

enter image description here

Please, can you help?
Thanks.

asked Dec 13, 2017 in Engine by DaveMS (71 points)

changing the parent propertis affects the children settings and/or viceversa

Which settings do you change? How does your gui look like before and after the reset? How are your Size Flags of the VBox' children set?

Anchor settings (Begin, End, Center or Ratio), which a set to "Ratio", got reset to "Begin".
Label's font size, which I scaled down to 0.5, got reset to 1.

This is the editor appearance:

enter image description here

while the emulator shows this:

enter image description here

Thanks for clarification. I will try to reproduce this on my own.

1 Answer

0 votes

Have you read following:

http://docs.godotengine.org/en/stable/learning/features/viewports/multiple_resolutions.html

And if you would like you can take a look at this (Shameless Self Promotion xD):
https://godotengine.org/qa/9947/responsive-to-fit-multiple-resolutions

answered Dec 15, 2017 by Rasmus (300 points)

Yes, I do read the section about resizing, but this is not a matter of "resizing", it's a problem related to proportion between the GUI elements, margins and centering to each other.
I want the title to be at 25% of the screen heigth, the Play button exactly in the center and the three more option button at the bottom (75% of the screen heigth) whatever the screen size is.
That's why I choose to use the "Ratio" option in margin settings; and that choice reset in cascade at (almost) every adjustment of the parent or grand-parent container.

Of course I could set position programmatically; I just wonder why the Inspector behaves like that.

I had the same resetting behaviour once but couldn't figure out what the problem was. Maybe it is a bug and should be investigated by the devs. Could you please create an issue on github and try to explain how to reproduce the problem? Maybe you could also provide a minimal sample project (including only your gui scene).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.