diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 4c999c07e12..c8eaaa0b698 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -3193,9 +3193,11 @@ Error GLTFDocument::_serialize_meshes(Ref p_state) { primitives.push_back(primitive); } - Dictionary e; - e["targetNames"] = target_names; - gltf_mesh["extras"] = e; + if (!target_names.is_empty()) { + Dictionary e; + e["targetNames"] = target_names; + gltf_mesh["extras"] = e; + } _attach_meta_to_extras(import_mesh, gltf_mesh); weights.resize(target_names.size());