Skip to main content

component

Decorator that marks a class as a script component.

TypeNameInterface Description
Functionscomponent(): (target: T) => void

Function: Decorator that marks a class as a script component. Script components can be attached to scene objects to add custom behavior. This decorator should be applied to classes that extend APJS.BasicScriptComponent.

Returns Class decorator function

Example

@component()
export class PlayerController extends APJS.BasicScriptComponent {
@serializeProperty
public moveSpeed: number = 5;

onUpdate(deltaTime: number): void {
// Movement logic here
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies