0 votes

I have a GridContainer that gets nodes added to it:

my_container.add_child(node)

And this node appears nicely in the center. However, if I try to add another node:

my_container.add_child(node2)

It also appears right in the center, on top of the first node. If I try to force the container to sort:

queue_sort()

Nothing happens.

How can I get my nodes to show up nicely in a grid container like they do if I put them in there with the editor?

Thanks!

EDIT:

If I add a Button node this way it seems to work as expected, but if I add a Sprite node, for example, it doesn't work. Maybe it only works with control nodes?

in Engine by (19 points)
edited by

1 Answer

0 votes

Maybe it only works with control nodes?

Correct.

by (10,467 points)
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.