Skip to content

API Function defineComponent

github-actions[bot] edited this page Nov 24, 2026 · 1 revision

Function: defineComponent()

function defineComponent<S>(
   id, 
   schema, 
   options?
): DataComponentDef<S>;

Defined in: src/engine/core/data.ts:52

Declare a data component.

export const Velocity = defineComponent("game.Velocity", { x: f32, y: f32, z: f32 });

Type Parameters

S

S extends Schema

Parameters

id

string

schema

S

options?

key?

string

Returns

DataComponentDef<S>

Clone this wiki locally