diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-26 10:49:01 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-26 10:49:01 +0100 |
commit | 5059dd91f3a618e2bae60cc8db0da5079294e075 (patch) | |
tree | 9e6cfd670d386c47f15aaea08de00c5cf99f3379 /modules/mono/csharp_script.cpp | |
parent | abe73c3db0e2013cabae2e8e593ddba7d9aad599 (diff) | |
parent | c5e6a5863db21ecbcbc6fcd006cb2aac744d39cd (diff) | |
download | redot-engine-5059dd91f3a618e2bae60cc8db0da5079294e075.tar.gz |
Merge pull request #88692 from nongvantinh/fix-88543
Fix Script Editor saves C# files as embedded scripts.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 0345eebef6..88fe82c6b8 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2851,7 +2851,22 @@ Ref<Resource> ResourceFormatLoaderCSharpScript::load(const String &p_path, const ERR_FAIL_COND_V_MSG(!scr->get_path().is_empty() && scr->get_path() != p_original_path, Ref<Resource>(), "The C# script path is different from the path it was registered in the C# dictionary."); - scr->set_path(p_original_path, true); + Ref<Resource> existing = ResourceCache::get_ref(p_path); + switch (p_cache_mode) { + case ResourceFormatLoader::CACHE_MODE_IGNORE: + break; + case ResourceFormatLoader::CACHE_MODE_REUSE: + if (existing.is_null()) { + scr->set_path(p_original_path); + } else { + scr = existing; + } + break; + case ResourceFormatLoader::CACHE_MODE_REPLACE: + scr->set_path(p_original_path, true); + break; + } + scr->reload(); if (r_error) { |