summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-21 22:44:05 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-01-21 22:44:09 +0100
commit077e48977384a1b1c2e527e5df9012b64b56e847 (patch)
tree22b15dcd099a77615d64aaef6c516b2a95e68f74 /modules/mono/csharp_script.cpp
parent6fa632b82121aff5537d627364d2f10fdeafc418 (diff)
downloadredot-engine-077e48977384a1b1c2e527e5df9012b64b56e847.tar.gz
Mono: Add assembly reloading to running games
Add environment variable to specify a custom --debugger-agent for mono.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 13f8385745..02220ab52f 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -608,30 +608,9 @@ struct CSharpScriptDepSort {
void CSharpLanguage::reload_all_scripts() {
#ifdef DEBUG_ENABLED
-
- List<Ref<CSharpScript> > scripts;
-
- {
- SCOPED_MUTEX_LOCK(script_instances_mutex);
-
- SelfList<CSharpScript> *elem = script_list.first();
- while (elem) {
- if (elem->self()->get_path().is_resource_file()) {
- scripts.push_back(Ref<CSharpScript>(elem->self())); //cast to gdscript to avoid being erased by accident
- }
- elem = elem->next();
- }
- }
-
- //as scripts are going to be reloaded, must proceed without locking here
-
- scripts.sort_custom<CSharpScriptDepSort>(); //update in inheritance dependency order
-
- for (List<Ref<CSharpScript> >::Element *E = scripts.front(); E; E = E->next()) {
- E->get()->load_source_code(E->get()->get_path());
- E->get()->reload(true);
+ if (is_assembly_reloading_needed()) {
+ reload_assemblies(false);
}
-
#endif
}
@@ -829,7 +808,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
CSharpScript::StateBackup &state_backup = scr->pending_reload_state[obj_id];
// Backup placeholder script instance state before replacing it with a script instance
- obj->get_script_instance()->get_property_state(state_backup.properties);
+ si->get_property_state(state_backup.properties);
ScriptInstance *script_instance = scr->instance_create(obj);