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

useControlled

useControlled(trait?): Entity[]

Every entity this side’s player controls, in the order readControlled reads them, those holding trait alone where one is named: a list of the units the player commands, the kart the player drives. Read again each time a control changes and each time an entity gains or loses trait. Empty before the player joins.

const karts = useControlled(KartTrait);
Parameter Type
trait? Trait | PredictedTrait<any> | CoreTrait<any>

Entity[]