summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-04-23 11:34:28 +0200
committerGitHub <noreply@github.com>2020-04-23 11:34:28 +0200
commit8012be867cd1fd4e1dae80ef74db7a73861aa755 (patch)
tree3bf150ff040cffab59d0a98ae4dd6a56b7fcb36a
parent45766f1adc83710a0484dfa15733b3d4fdbea2f1 (diff)
parentc9882e61e2ccc248ee3728ea936bb42e9d145528 (diff)
Merge pull request #38123 from neikeq/fix-hotreload-twice
Mono/C#: Fix assemblies being reloaded a second time unnecesarily
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index 681bb3e2d8..3298c5da4c 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -1387,7 +1387,10 @@ bool _GodotSharp::is_runtime_initialized() {
void _GodotSharp::_reload_assemblies(bool p_soft_reload) {
#ifdef GD_MONO_HOT_RELOAD
- CSharpLanguage::get_singleton()->reload_assemblies(p_soft_reload);
+ // This method may be called more than once with `call_deferred`, so we need to check
+ // again if reloading is needed to avoid reloading multiple times unnecessarily.
+ if (CSharpLanguage::get_singleton()->is_assembly_reloading_needed())
+ CSharpLanguage::get_singleton()->reload_assemblies(p_soft_reload);
#endif
}