1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Fix Resource doesn't update when overwritten in editor

This commit is contained in:
LuoZhihao
2025-06-29 01:08:11 +08:00
parent 4e6ac9bccc
commit 0c74c0978f
2 changed files with 11 additions and 6 deletions

View File

@@ -1585,7 +1585,13 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
return;
}
((Resource *)p_resource.ptr())->set_path(path);
Ref<Resource> prev_resource = ResourceCache::get_ref(p_path);
if (prev_resource.is_null() || prev_resource != p_resource) {
p_resource->set_path(path, true);
}
if (prev_resource.is_valid() && prev_resource != p_resource) {
replace_resources_in_scenes({ prev_resource }, { p_resource });
}
saving_resources_in_path.erase(p_resource);
_resource_saved(p_resource, path);