Prevent cache corruption when saving resources in the editor

This commit is contained in:
Yuri Sizov 2023-03-08 19:46:55 +01:00
parent bed6c1dc49
commit 496bd94c21
3 changed files with 22 additions and 2 deletions

View file

@ -1010,12 +1010,14 @@ void GDScript::_bind_methods() {
}
void GDScript::set_path(const String &p_path, bool p_take_over) {
String old_path = path;
if (is_root_script()) {
Script::set_path(p_path, p_take_over);
}
this->path = p_path;
String old_path = path;
path = p_path;
GDScriptCache::move_script(old_path, p_path);
for (KeyValue<StringName, Ref<GDScript>> &kv : subclasses) {
kv.value->set_path(p_path, p_take_over);
}