diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 2be563ed04e..2b99545096e 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1078,6 +1078,13 @@ void GDScript::set_path_cache(const String &p_path) { if (is_root_script()) { Script::set_path_cache(p_path); } + + path = p_path; + path_valid = true; + + for (KeyValue> &kv : subclasses) { + kv.value->set_path_cache(p_path); + } } void GDScript::set_path(const String &p_path, bool p_take_over) { diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index e57376dce2e..839eeab335c 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -153,7 +153,7 @@ thread_local SafeBinaryMutex::TLSData SafeBinar SafeBinaryMutex GDScriptCache::mutex; void GDScriptCache::move_script(const String &p_from, const String &p_to) { - if (singleton == nullptr || p_from == p_to) { + if (singleton == nullptr || p_from == p_to || p_from.is_empty()) { return; }