pub struct Spawner {
pub template: AssetId,
pub interval: f32,
pub lifetime: f32,
pub elapsed: f32,
pub count: u32,
}Expand description
Periodically instantiates copies of an existing placement at this entity’s position.
A spawner clones template (the name of another placement in the world)
every interval seconds, giving each copy a lifetime after which it is
automatically removed. Pairing a short lifetime with a short interval keeps a
bounded population churning (an enemy wave, a particle of debris, a fountain
of props) and is what exercises GPU draw-slot recycling: each expiry frees a
slot the next spawn reuses.
The spawner’s own Transform (its position) is where copies appear, so place
the spawner where you want the stream to originate.
Fields§
§template: AssetIdName of the placement to copy on each spawn.
interval: f32Seconds between spawns.
lifetime: f32Seconds each spawned copy lives before auto-removal; 0 keeps it forever.
elapsed: f32Runtime: seconds accumulated toward the next spawn.
count: u32Runtime: number of copies spawned so far.
Implementations§
Trait Implementations§
Source§impl Component for Spawner
impl Component for Spawner
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Source§impl ComponentSlot for Spawner
impl ComponentSlot for Spawner
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.