diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 42de02a9e63..7ce92989f7f 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -36,6 +36,7 @@ #include "core/io/missing_resource.h" #include "core/object/script_language.h" #include "core/version.h" +#include "scene/property_utils.h" #include "scene/resources/packed_scene.h" //#define print_bl(m_what) print_line(m_what) @@ -2284,7 +2285,8 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Refget_class(), F.name); + bool is_script = F.name == CoreStringName(script); + Variant default_value = is_script ? Variant() : PropertyUtils::get_property_default_value(E.ptr(), F.name); if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, p.value, default_value))) { continue; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 99b906fd06c..1291680bbc7 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1931,7 +1931,8 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref