Is it possible to get all the members of a group?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheBaldChick

Hello

I have a group that has more than one member. I want to access all the members in that group, not only one. How can i do this?

If it is not possible to do this, then is there a way to tag objects in godot? (Like in Unity for example).

Thanks.

:bust_in_silhouette: Reply From: hinasis

You can get an Array with each member of your group doing:

var my_group_members = get_tree().get_nodes_in_group("my_group")

You can also call an specific method for all members:

get_tree().call_group("my_group","my_function",args...)

If you need to do something with your group:

for member in get_tree().get_nodes_in_group("my_group"):
	member.my_function(args...)