You've already forked godot
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user