serializeProperty
Decorator that marks a property for serialization.
| Type | Name | Interface Description |
|---|---|---|
| Functions | serializeProperty(): (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;
}