extends Node func find_first_node_of_type(node: Node, type: Variant): for child in node.get_children(): if is_instance_of(child, type): return child return null func get_nodes_of_class(node: Node, type: Variant) -> Array: var nodes = [] for child in node.get_children(true): if is_instance_of(child, type): nodes.append(child) elif child.get_child_count(true) > 0: nodes.append_array(get_nodes_of_class(child, type)) return nodes