mirror of
https://github.com/godotengine/godot.git
synced 2026-04-19 10:21:02 +00:00
Merge pull request #117070 from shoyguer/bugfix/could_not_resolve_after_preload_name_change
Fix "Could not resolve script" error after renaming a preloaded script
This commit is contained in:
commit
f9dfbbb0ed
1 changed files with 6 additions and 0 deletions
|
|
@ -1105,6 +1105,12 @@ void GDScript::set_path(const String &p_path, bool p_take_over) {
|
|||
String old_path = path;
|
||||
path = p_path;
|
||||
path_valid = true;
|
||||
|
||||
String old_base = GDScript::canonicalize_path(old_path);
|
||||
if (!old_base.is_empty() && fully_qualified_name.begins_with(old_base)) {
|
||||
fully_qualified_name = GDScript::canonicalize_path(p_path) + fully_qualified_name.substr(old_base.length());
|
||||
}
|
||||
|
||||
if (is_root_script()) {
|
||||
GDScriptCache::move_script(old_path, p_path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue