summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2023-06-28 12:51:59 +0200
committerGitHub <noreply@github.com>2023-06-28 12:51:59 +0200
commit9a09ee5d0217c4d5e5668fccddfa477bf16af357 (patch)
treecca551c6eb49634099e2c67d410f9b19c67b7c15 /modules/mono/csharp_script.cpp
parentd95b516d312a9f3930a96c0fdd51cf975345f16f (diff)
parent60b9eb169e8bcfe69cadea4e6f0f676cda6e993d (diff)
downloadredot-engine-9a09ee5d0217c4d5e5668fccddfa477bf16af357.tar.gz
Merge pull request #78787 from RedworkDE/net-non-tool-reload
C#: Fix reloading of non-tool scripts
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index d9c372e930..3e032f213b 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -781,7 +781,8 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
MutexLock lock(script_instances_mutex);
for (SelfList<CSharpScript> *elem = script_list.first(); elem; elem = elem->next()) {
- bool is_reloadable = false;
+ // Do not reload scripts with only non-collectible instances to avoid disrupting event subscriptions and such.
+ bool is_reloadable = elem->self()->instances.size() == 0;
for (Object *obj : elem->self()->instances) {
ERR_CONTINUE(!obj->get_script_instance());
CSharpInstance *csi = static_cast<CSharpInstance *>(obj->get_script_instance());