From b0c807c75a0c45cf9a58381dea8a4ccf99c63dea Mon Sep 17 00:00:00 2001 From: Jonathan Gollnick Date: Wed, 9 Jun 2021 19:38:21 -0500 Subject: [PATCH] Fix auto reload scripts on external change --- modules/gdscript/gdscript_cache.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index 07f50d14dcb9..9f7fa87871b4 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -198,7 +198,15 @@ Ref GDScriptCache::get_full_script(const String &p_path, Error &r_erro r_error = OK; if (singleton->full_gdscript_cache.has(p_path)) { - return singleton->full_gdscript_cache[p_path]; + Ref script = singleton->full_gdscript_cache[p_path]; +#ifdef TOOLS_ENABLED + uint64_t mt = FileAccess::get_modified_time(p_path); + if (script->get_last_modified_time() == mt) { + return script; + } +#else + return script; +#endif //TOOLS_ENABLED } Ref script = get_shallow_script(p_path);