Skip to main content

serializeProperty

Decorator that marks a property for serialization.

TypeNameInterface Description
FunctionsserializeProperty(): (target: any, key: string) => any

Function: Decorator that marks a property for serialization. Properties marked with this decorator will be saved and loaded with the scene. This decorator can be used with or without parentheses.

Returns Property decorator function when used with parentheses

Example

@component()
export class PlayerData extends APJS.BasicScriptComponent {
// Usage without parentheses
@serializeProperty
public playerName: string = "Player";

// Usage with parentheses
@serializeProperty()
public score: number = 0;

// This property won't be saved
public temporaryData: number = 0;
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies