pub fn spawn_from_template(
ctx: &mut PipelineContext<'_>,
template: Entity,
name: Option<AssetId>,
transform: Transform,
lifetime: Option<f32>,
clone_slot: impl FnMut(usize, [[f32; 4]; 4]) -> Option<usize>,
) -> Option<Entity>Expand description
Instantiate a runtime copy of template’s renderable: clone each of its
backend draw slots at transform through clone_slot, then build a new
entity carrying the cloned slots, a copy of the template’s renderer, the
placement, and an optional Lifetime.
clone_slot(src_draw_idx, model) returns the new backend slot index (a
vacated slot reused, or a freshly appended one); it is the seam a host wires
to its own allocator. When name is Some the new entity is registered under
it so it can later be addressed by name like an authored placement;
transient spawns (a Spawner’s churn) pass None to avoid interning a name per
spawn. Returns the new entity, or None when the template has no draw slots to
copy or a clone fails.