diff --git a/core/script_language.cpp b/core/script_language.cpp index 96313898ec4..ed0688817cc 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -277,7 +277,9 @@ void ScriptServer::save_global_classes() { } if (gcarr.empty()) { - ProjectSettings::get_singleton()->clear("_global_script_classes"); + if (ProjectSettings::get_singleton()->has_setting("_global_script_classes")) { + ProjectSettings::get_singleton()->clear("_global_script_classes"); + } } else { ProjectSettings::get_singleton()->set("_global_script_classes", gcarr); } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 93486860a77..0f6e3485dae 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -966,7 +966,9 @@ void EditorData::script_class_save_icon_paths() { } if (d.empty()) { - ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + if (ProjectSettings::get_singleton()->has_setting("_global_script_class_icons")) { + ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + } } else { ProjectSettings::get_singleton()->set("_global_script_class_icons", d); }