summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index b6caefbdb5..1a1d021dbc 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -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);
}