Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

onTraitChange

onTraitChange(world, trait, listener): () => void

Koota’s world.onChange, which also takes a predicted or a core trait: calls listener with each entity whose record of trait is set, and returns the call that stops it. A HUD hears a player’s connection drop with onTraitChange(world, ConnectionTrait, notify).

Parameter Type
world World
trait PredictedTrait<any> | Trait | CoreTrait<any>
listener (entity) => void

() => void