pub fn duplicate_entity(
world: &mut GameWorld,
entity: EntityId,
state: &mut EditorState,
)Expand description
Duplicates an entity and everything below it.
Goes through the same subtree recipe round-trip as “Save as Prefab” rather
than copying a hand-listed set of components, so the copy carries Tag,
every user-defined component and the whole descendant subtree — none of
which a fixed list could know about. serialize_all_components filters out
engine-written components, so GlobalTransform and Children are rebuilt
for the copy instead of being cloned with the original’s entity ids.
serialize_subtree deliberately drops the root’s own parent edge (a
.kprefab has to be self-contained), so the copy is re-parented here to
land as a sibling of the original.