0 votes

I am working on a node in my scene tree and i will like to add other nodes in same scene as a member to a group created by the node i am currently working on. My question is can a node be in a Group without being a child to the node creating the group?

Godot version Godot_3.4
in Engine by (17 points)

1 Answer

+1 vote
Best answer

Yes. Groups are tagged at the SceneTree level, not the node level.

That's why you use get_tree().get_nodes_in_group("some_group") not get_node("some_random_node").get_nodes_in_group("some_group"). You can either use add_to_group("some_group") from inside the node's script or tag it in the editor:

https://docs.godotengine.org/en/latest/tutorials/scripting/groups.html

by (3,707 points)
selected by

thank you very much bro.

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.