summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gollnick <jonathan.gollnick@gmail.com>2021-06-09 19:38:21 -0500
committerJonathan Gollnick <jonathan.gollnick@gmail.com>2021-09-02 20:28:02 -0500
commitb0c807c75a0c45cf9a58381dea8a4ccf99c63dea (patch)
tree33bf8601925146ca59dc09b2e161fd04c80a8e55
parentc39d31899a9e35fb1166834c68b566978ef5066d (diff)
downloadredot-engine-b0c807c75a0c45cf9a58381dea8a4ccf99c63dea.tar.gz
Fix auto reload scripts on external change
-rw-r--r--modules/gdscript/gdscript_cache.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp
index 07f50d14dc..9f7fa87871 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -198,7 +198,15 @@ Ref<GDScript> 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<GDScript> 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<GDScript> script = get_shallow_script(p_path);