diff --git a/main/main.cpp b/main/main.cpp index 33878ab1163..450908a6f73 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1590,7 +1590,6 @@ bool Main::start() { } } - String main_loop_type; #ifdef TOOLS_ENABLED if (doc_tool_path != "") { Engine::get_singleton()->set_editor_hint(true); // Needed to instance editor-only classes for their default values @@ -1661,6 +1660,7 @@ bool Main::start() { if (editor) { main_loop = memnew(SceneTree); }; + String main_loop_type = GLOBAL_DEF("application/run/main_loop_type", "SceneTree"); if (test != "") { #ifdef TOOLS_ENABLED @@ -1699,8 +1699,23 @@ bool Main::start() { return false; } - } else { - main_loop_type = GLOBAL_DEF("application/run/main_loop_type", ""); + } else { // Not based on script path. + if (!editor && !ClassDB::class_exists(main_loop_type) && ScriptServer::is_global_class(main_loop_type)) { + String script_path = ScriptServer::get_global_class_path(main_loop_type); + Ref