Skip to content

Commit 67c78d2

Browse files
authored
Fix dart8 tag component deserialization (#2236)
1 parent e460dc7 commit 67c78d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dart8/io/serializer.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,12 @@ class TypedComponentSerializer : public ComponentSerializer
227227
{
228228
ComponentT component;
229229
loadComponent(in, component);
230-
registry.emplace<ComponentT>(entity, std::move(component));
230+
if constexpr (std::is_empty_v<ComponentT>) {
231+
// Tag components in EnTT must be emplaced without constructor args
232+
registry.emplace<ComponentT>(entity);
233+
} else {
234+
registry.emplace<ComponentT>(entity, std::move(component));
235+
}
231236
}
232237

233238
bool hasComponent(

0 commit comments

Comments
 (0)