diff --git a/Core/GDCore/Project/CustomConfigurationHelper.cpp b/Core/GDCore/Project/CustomConfigurationHelper.cpp index 04b272157c67..8880fc8b5fdb 100644 --- a/Core/GDCore/Project/CustomConfigurationHelper.cpp +++ b/Core/GDCore/Project/CustomConfigurationHelper.cpp @@ -22,11 +22,13 @@ void CustomConfigurationHelper::InitializeContent( gd::SerializerElement &configurationContent) { for (auto &&property : properties.GetInternalVector()) { auto &element = configurationContent.AddChild(property->GetName()); - auto propertyType = property->GetType(); - const auto &primitiveType = gd::ValueTypeMetadata::GetPrimitiveValueType( - gd::ValueTypeMetadata::ConvertPropertyTypeToValueType(propertyType)); - if (primitiveType == "string") { + const auto &valueType = + gd::ValueTypeMetadata::ConvertPropertyTypeToValueType( + property->GetType()); + const auto &primitiveType = + gd::ValueTypeMetadata::GetPrimitiveValueType(valueType); + if (primitiveType == "string" || valueType == "behavior") { element.SetStringValue(property->GetValue()); } else if (primitiveType == "number") { element.SetDoubleValue(property->GetValue().To()); @@ -43,17 +45,19 @@ std::map CustomConfigurationHelper::GetPrope for (auto &property : properties.GetInternalVector()) { const auto &propertyName = property->GetName(); - const auto &propertyType = property->GetType(); // Copy the property objectProperties[propertyName] = *property; auto &newProperty = objectProperties[propertyName]; - const auto &primitiveType = gd::ValueTypeMetadata::GetPrimitiveValueType( - gd::ValueTypeMetadata::ConvertPropertyTypeToValueType(propertyType)); + const auto &valueType = + gd::ValueTypeMetadata::ConvertPropertyTypeToValueType( + property->GetType()); + const auto &primitiveType = + gd::ValueTypeMetadata::GetPrimitiveValueType(valueType); if (configurationContent.HasChild(propertyName)) { - if (primitiveType == "string") { + if (primitiveType == "string" || valueType == "behavior") { newProperty.SetValue( configurationContent.GetChild(propertyName).GetStringValue()); } else if (primitiveType == "number") { @@ -85,11 +89,12 @@ bool CustomConfigurationHelper::UpdateProperty( const auto &property = properties.Get(propertyName); auto &element = configurationContent.AddChild(propertyName); - const gd::String &propertyType = property.GetType(); - const auto &primitiveType = gd::ValueTypeMetadata::GetPrimitiveValueType( - gd::ValueTypeMetadata::ConvertPropertyTypeToValueType(propertyType)); - if (primitiveType == "string") { + const auto &valueType = + gd::ValueTypeMetadata::ConvertPropertyTypeToValueType(property.GetType()); + const auto &primitiveType = + gd::ValueTypeMetadata::GetPrimitiveValueType(valueType); + if (primitiveType == "string" || valueType == "behavior") { element.SetStringValue(newValue); } else if (primitiveType == "number") { element.SetDoubleValue(newValue.To()); diff --git a/GDJS/GDJS/Events/CodeGeneration/BehaviorCodeGenerator.cpp b/GDJS/GDJS/Events/CodeGeneration/BehaviorCodeGenerator.cpp index 09677d7e2d93..0543a13e95d9 100644 --- a/GDJS/GDJS/Events/CodeGeneration/BehaviorCodeGenerator.cpp +++ b/GDJS/GDJS/Events/CodeGeneration/BehaviorCodeGenerator.cpp @@ -421,10 +421,11 @@ gd::String BehaviorCodeGenerator::GenerateUpdatePropertyFromNetworkSyncDataCode( gd::String BehaviorCodeGenerator::GeneratePropertyValueCode( const gd::PropertyDescriptor& property) { - const auto &primitiveType = gd::ValueTypeMetadata::GetPrimitiveValueType( - gd::ValueTypeMetadata::ConvertPropertyTypeToValueType( - property.GetType())); - if (primitiveType == "string") { + const auto &valueType = + gd::ValueTypeMetadata::ConvertPropertyTypeToValueType(property.GetType()); + const auto &primitiveType = + gd::ValueTypeMetadata::GetPrimitiveValueType(valueType); + if (primitiveType == "string" || valueType == "behavior") { return EventsCodeGenerator::ConvertToStringExplicit(property.GetValue()); } else if (primitiveType == "number") { return "Number(" +