0 votes

I'm having an issue where, during run time when the children of a margin container change. The container disregards the size flags scaling and simply grows larger, regardless of if the children could easily fit inside the container without scaling.

This size flags work just find in editor, this only seems to bug during run time.

in Engine by (344 points)

What version of Godot are you using? I can't seem to replicate this. What size flags are you using?

Using 3.3 and I have a HBoxContainer with horizontal flags set at: Expand and Shrink Center.

I then have default buttons that populate inside the container as children during a for loop function. Their H and V flags are both set at 1: Fill

When I put a button as a child manually in the editor and then duplicated it, it updates and just fine and looks great. But when the for loop adds the same button, the Shrink Center flag doesn't seem to update and it tacks on the button towards the right side of the initially centered button. It either does that OR moves the buttons, but doesn't resize the buttons down to their text as it should since the buttons don't have a rect_min_size, this causes the buttons to be large and populate off screen. The whole thing just kind of bugs out when a loop adds to the HBoxContainer in general.

Please log in or register to answer this question.

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.