Skip to content

Kiln API / kiln / DespawnOnExit

Variable: DespawnOnExit ​

ts
const DespawnOnExit: Trait<{
  state: string;
  value: string;
}>;

Despawns the entity when its state is left: commands.spawn(..., despawnOnExit(Screen, 'playing')). state is the state's name, value the state value it belongs to.