Browse Source

Fix unsaved changes not getting discarded

kobewi 1 year ago
parent
commit
5d85551ab3
1 changed files with 4 additions and 0 deletions
  1. 4 0
      editor/plugins/script_editor_plugin.cpp

+ 4 - 0
editor/plugins/script_editor_plugin.cpp

@@ -863,6 +863,10 @@ void ScriptEditor::_close_current_tab(bool p_save) {
 }
 
 void ScriptEditor::_close_discard_current_tab(const String &p_str) {
+	Ref<Script> scr = _get_current_script();
+	if (scr.is_valid()) {
+		scr->reload_from_file();
+	}
 	_close_tab(tab_container->get_current_tab(), false);
 	erase_tab_confirm->hide();
 }