Skip to main content

serialize_all_components

Function serialize_all_components 

Source
pub fn serialize_all_components(
    world: &World,
    entity: EntityId,
) -> Vec<(String, Vec<u8>)>
Expand description

Serializes every component of entity that belongs to the author.

Skips ComponentProvenance::Derived and ComponentProvenance::Runtime components, because every caller — scene files, .kprefab extraction and entity duplication — wants the data a human or a tool put there, not what the engine computed from it.

Emitting them would be actively wrong, not merely wasteful: Children holds the source entity’s EntityIds, so a copy would claim the original’s children, and GlobalTransform would land stale until the next transform_propagation tick. Hierarchy is rebuilt from the recipe’s SetParent commands instead, which remap ids properly.