Marks a field for serialization and editor exposure. Required for fields that reference
other objects, components, or assets. Primitive types (string, number, boolean) work without a type argument.

@serializable()
speed: number = 1;

@serializable()
label: string = "Hello";
@serializable(Object3D)
target: Object3D | null = null;

@serializable(Renderer)
myRenderer: Renderer | null = null;
@serializable([Object3D])
waypoints: Object3D[] = [];

syncField for automatic network synchronization

  • Type Parameters

    • T

    Parameters

    • Optionaltype: null | Constructor<T> | TypeResolver<T> | (Constructor<any> | TypeResolver<T>)[]

      The constructor type for complex objects. Omit for primitives.

    Returns (_target: any, _propertyKey: string | { name: string }) => void