diff options
| author | Ignacio Etcheverry | 2018-04-24 20:36:17 +0200 |
|---|---|---|
| committer | Ignacio Etcheverry | 2018-04-24 20:46:53 +0200 |
| commit | 89e84185e8cbd08531ae33554cf78ffba692cf7a (patch) | |
| tree | f7752b5416cb5b17a941ea3d8c552512923735fb /modules/mono/csharp_script.cpp | |
| parent | 098c7ba4f9c49b472b9417819144378081996874 (diff) | |
| download | godot-89e84185e8cbd08531ae33554cf78ffba692cf7a.tar.gz godot-89e84185e8cbd08531ae33554cf78ffba692cf7a.tar.zst godot-89e84185e8cbd08531ae33554cf78ffba692cf7a.zip | |
Diffstat (limited to 'modules/mono/csharp_script.cpp')
| -rw-r--r-- | modules/mono/csharp_script.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 1d0afa7f2..254079820 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2288,7 +2288,9 @@ RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p CRASH_COND(mono_domain_get() == NULL); #endif -#else +#endif + +#ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && mono_domain_get() == NULL) { CRASH_COND(Thread::get_caller_id() == Thread::get_main_id()); @@ -2297,14 +2299,20 @@ RES ResourceFormatLoaderCSharpScript::load(const String &p_path, const String &p // because this may be called by one of the editor's worker threads. // Attach this thread temporarily to reload the script. - MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN); - CRASH_COND(mono_thread == NULL); + if (SCRIPTS_DOMAIN) { + MonoThread *mono_thread = mono_thread_attach(SCRIPTS_DOMAIN); + CRASH_COND(mono_thread == NULL); + script->reload(); + mono_thread_detach(mono_thread); + } + + } else { // just reload it normally +#endif script->reload(); - mono_thread_detach(mono_thread); - } else // just reload it normally +#ifdef TOOLS_ENABLED + } #endif - script->reload(); if (r_error) *r_error = OK; |
