This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

I have a grid container of 5 columns and 5 buttons. I have disabled all other buttons by using .hide() when a button is pressed, but the container treats all other nodes as if they never existed and rearranges the button into column 1 every time...

Is there an option within the engine to keep their current positions?

in Engine by (27 points)

1 Answer

+2 votes
Best answer

I think this container doesn't let you do that at the moment. To workaround that, you may want to replace the nodes by empty controls, or change modulate of your hidden buttons to a transparent color. Or add empty controls which in turn have buttons as children, so you can hide the button while still taking space in the grid. Or maybe write your own container if you are feeling adventurous.

by (29,510 points)
selected by

So I found a workaround, for those future duckduckGo'ers:

Use the gridContainer, add the child nodes and set up spacing etc. first.
Then I changed gridContainer type to "control" by right clicking the node from the scene list.. This just inherited all of gridContainers spacings without rearranging everything when something becomes hidden or removed.

That's fine if your GUI does not handle multiple resolutions / multiple languages (in case buttons have text).

Hrm. Good point. I'll probably have to use your method in that case.

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 Frequently asked questions and 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 [email protected] with your username.