pub fn serialize_subtree(
world: &World,
root: EntityId,
) -> Result<Vec<u8>, SerializationError>Expand description
Encodes the subtree rooted at root (root + all descendants reached
via the Children component) as a stand-alone bincode-encoded
SceneRecipe. Exists to back the editor’s “Save as Prefab” flow:
the resulting bytes round-trip through instantiate_subtree.
Hierarchy edges are emitted only for parent/child pairs whose both
endpoints live inside the subtree, so a .kprefab file is fully
self-contained. The first Spawn command is the prefab root.