extends DebugMenuBase


func _find_target_scene():
	# Fixed: Search more thoroughly for match3 scene
	if match3_scene:
		# Already found, stop searching
		_stop_search_timer()
		return

	# Search in current scene tree
	var current_scene = get_tree().current_scene
	if current_scene:
		# Try to find match3 by script path first
		match3_scene = _find_node_by_script(current_scene, target_script_path)

		# Fallback: search by common node names
		if not match3_scene:
			for possible_name in ["Match3", "match3", "Match3Game"]:
				match3_scene = current_scene.find_child(possible_name, true, false)
				if match3_scene:
					break

	if match3_scene:
		DebugManager.log_debug("Found match3 scene: " + match3_scene.name, log_category)
		_update_ui_from_scene()
		_stop_search_timer()
	else:
		# Continue searching if not found
		_start_search_timer()
