extends Node func get_first_node_of_type(parent: Node, type: Variant, include_internal: bool = false) -> Node: var result = null for child in parent.get_children(include_internal): if is_instance_of(child, type): result = child break elif child.get_child_count(include_internal) > 0: result = get_first_node_of_type(child, type, include_internal) if result != null: break return result func get_nodes_of_class(parent: Node, type: Variant, include_internal: bool = false) -> Array[Variant]: var nodes: Array[Variant] = [] for child in parent.get_children(include_internal): if is_instance_of(child, type): nodes.append(child) elif child.get_child_count(include_internal) > 0: nodes.append_array(get_nodes_of_class(child, type, include_internal)) return nodes