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

defineTraitView

defineTraitView(trait, view): Disposer

Gives every entity that holds trait, and names no view, no model and no prefab’s view, view to draw with: the first registered trait it holds decides, in registration order. A character takes it whatever model the character wears, over the view characters({ view }) declares, and reads the character’s model through CharacterView. Returns what forgets it. Throws for a second view on one trait, unless the module that defined the first runs again, as a hot reload runs it.

Parameter Type
trait ViewedTrait
view EntityView

Disposer