I don’t think there any single, built-in way to do that. I’d probably get the nodes in the group of interest and then get their children. So, something like this:
func _ready():
for node in get_tree().get_nodes_in_group("the_group"):
print(node.name)
for child in node.get_children():
print(" " + child.name)
Don’t know if this will be useful, but I found this thread first when I looked for a find_child_in_group function, here are the two I created if somebody has use for them
class_name Tools
static func find_child_in_group(parent: Node, group: String, recursive: bool = false):
var output: Node = null
for child in parent.get_children() :
if child.is_in_group(group) :
return child
if recursive :
for child in parent.get_children() :
output = find_child_in_group(child, group, recursive)
if output != null :
return output
return output
static func find_children_in_group(parent: Node, group: String, recursive: bool = false):
var output: Array[Node] = []
for child in parent.get_children() :
if child.is_in_group(group) :
output.append(child)
if recursive :
for child in parent.get_children() :
var recursive_output = find_children_in_group(child, group, recursive)
for recursive_child in recursive_output :
output.append(recursive_child)
return output