From 976b1ddec5d0cd22b4cb645c6be36d61c0494103 Mon Sep 17 00:00:00 2001 From: Marius Hanl Date: Tue, 29 Nov 2022 23:34:05 +0100 Subject: [PATCH] Try loading the path specified in a preload(..) method call with the ResourceLoader if the script code completion cache is not yet available This fixes the problem that autoloaded nodes could not be loaded because they (or there children) preload other nodes in their script. This was only happening on the start of Godot, as when the autoloaded nodes are resolved there is no code completion cache yet. --- modules/gdscript/gdscript_parser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 93f9852602a3..45066a8acdb6 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -527,6 +527,8 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s return nullptr; } else if (ScriptCodeCompletionCache::get_singleton()) { res = ScriptCodeCompletionCache::get_singleton()->get_cached_resource(path); + } else { + res = ResourceLoader::load(path); } } if (!res.is_valid()) {