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

Merge pull request #113598 from KoBeWi/reload_without_load_is_just_REEEEEE

Fix built-in script live reloading
This commit is contained in:
Thaddeus Crews
2025-12-08 11:53:53 -06:00
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);