0 votes

Greetings,
In Godot 2.1, putting nodes into a group is radically changed, and the new process is not in the documentation - however, I found an answer here:
https://godotengine.org/qa/7039/missing-features-of-ui?show=7039#q7039
BUT that leaves me with
THE QUESTION: How can I add multiple nodes to the same group all at once?

in Engine by (328 points)

1 Answer

+2 votes
Best answer

Doesn't look like there is a way to select them all and add them all via the editor GUI. So if you want some rapid way of creating groups, you may want to manage it at runtime in script.

For example inside a parent node, say you want all it's children to be grouped you could write something simple like this:

for child in get_children():
    child.add_to_group("my_group")

print(get_tree().get_nodes_in_group("my_group"))

You will find group methods in the SceneTree: http://docs.godotengine.org/en/stable/classes/class_scenetree.html

by (5,232 points)
selected by

Nice idea, I did this manually recently and wish I'd thought of that. Will try and remember for next time I'm grouping heaps of items.

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.