0 votes

I'm having an extremely frustrating problem with my UI; the size resets upon restarting the engine. I have it set up as follows:

CenterContainer
    -> VBoxContainer
        -> menu item 1 (TextureButton)
        -> menu item 2 (TextureButton)
        -> menu item 3 (TextureButton)

enter image description here

Both containers' size flags are set to 'Horizontal: fill, expand' and 'Vertical: fill, expand'. I had this exact issue before too, and setting the flags to the aforementioned settings worked. That was before adding the parent CenterContainer, though.

Not sure if worth mentioning, but the above nodes reside in another VBoxContainer, also set to 'fill, expand'.

in Engine by (12 points)

1 Answer

0 votes

I'd suggest trying setting "Stretch Ratio" under Size Flags to 0. It worked for me once. Also try it with enabling/disabling the other flags.

Coming from Godot 2.1, Godot 3's container sizing/positioning is pretty confusing. I still don't completely understand it either.

by (253 points)

First of all, thanks for commenting, I appreciate the help.

I've set the scale ratio of all the parent and child nodes to 0 and toyed around with the other flags with no success. In fact, toggling the expand and fill flags of the other nodes screwed with it even more.

It goes back to a functional state upon removing the CenterContainer. Thing is, I kind of need it. Are there other settings relating to how VBoxContainers are contained within a CenterContainer that I must look at?

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.