1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-31 18:41:20 +00:00

Fix built-in script live reloading

This commit is contained in:
kobewi
2025-12-04 23:27:06 +01:00
parent 78d91947f6
commit ad4fb8c1df
2 changed files with 12 additions and 4 deletions

View File

@@ -681,7 +681,15 @@ void RemoteDebugger::poll_events(bool p_is_idle) {
for (const Variant &v : script_paths_to_reload) {
const String &path = v;
Error err = OK;
Ref<Script> script = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
Ref<Script> script = ResourceCache::get_ref(path);
if (script.is_null()) {
if (path.is_resource_file()) {
script = ResourceLoader::load(path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
} else {
// Built-in script that isn't in ResourceCache, no need to reload.
continue;
}
}
ERR_CONTINUE_MSG(err != OK, vformat("Could not reload script '%s': %s", path, error_names[err]));
ERR_CONTINUE_MSG(script.is_null(), vformat("Could not reload script '%s': Not a script!", path, error_names[err]));
scripts_to_reload.push_back(script);