From f1c941d460ba47f7513f556a37162c512c833534 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 28 Jun 2025 13:55:08 +0200 Subject: [PATCH] Improve error message when UID main scene is not found --- main/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main/main.cpp b/main/main.cpp index 13ec7d3f4b2..ddf5c00e9df 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -4108,7 +4108,17 @@ int Main::start() { #endif // TOOLS_ENABLED if (script.is_empty() && game_path.is_empty()) { - game_path = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")); + const String main_scene = GLOBAL_GET("application/run/main_scene"); + if (main_scene.begins_with("uid://")) { + ResourceUID::ID id = ResourceUID::get_singleton()->text_to_id(main_scene); + if (!ResourceUID::get_singleton()->has_id(id) && !FileAccess::exists(ResourceUID::get_singleton()->get_cache_file())) { + OS::get_singleton()->alert("Main scene's path could not be resolved from UID. Make sure the project is imported first. Aborting."); + ERR_FAIL_V_MSG(EXIT_FAILURE, "Main scene's path could not be resolved from UID. Make sure the project is imported first. Aborting."); + } + game_path = ResourceUID::get_singleton()->get_id_path(id); + } else { + game_path = main_scene; + } } #ifdef TOOLS_ENABLED