0 votes

I'm looking at the doc but can't find a way to list all "active" groups. Something like a :

get_tree().get_groups()

that will return an array listing all groups of the scene.
I need to build and destroy many temporary groups. So I would like to iterate on that list to prevent duplicate group name. For now I use the instance id of the object that "created" the group as the group name to make sure it's unique, but it seams stacky and inefficient.
How Godot handle groups ? If I build a group by adding members then removing all, what happens to that group name, its reference is deleted ? so I shouldn't worry or does it stacks in some internal variable for further use and then it could be problematic.
Maybe I shouldn't worry.

in Engine by (37 points)

1 Answer

+1 vote

Groups are not objects, they are "tags" assigned to objects. You don't create a group, you stick a tag on a Node, and then you can ask "give me the nodes with this tag".

by (21,979 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 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.