defineComponent
defineComponent<
T>(name,defaults,metadata?):ComponentDef<T>
Defined in: ecs/component.ts:385
Declare a component type from its name and the defaults every instance starts
with. name is the identity a scene file stores, so it is what a saved entity
is rebound by; defining the same name twice returns the first definition
rather than replacing it, so a hot reload cannot orphan live entities.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”string
defaults
Section titled “defaults”T
metadata?
Section titled “metadata?”Returns
Section titled “Returns”ComponentDef<T>
Throws
Section titled “Throws”if name is already taken by a built-in engine component.