Skip to content

ECS Framework API v2.2.13


ECS Framework API / Serialize

Function: Serialize()

Serialize(options?): (target, propertyKey) => void

Defined in: packages/core/src/ECS/Serialization/SerializationDecorators.ts:116

字段序列化装饰器

标记字段为可序列化

Parameters

options?

FieldSerializeOptions

字段序列化选项(可选)

Returns

(target, propertyKey): void

Parameters

target

any

propertyKey

string | symbol

Returns

void

Example

typescript
@Serialize()
name: string = 'Player';

@Serialize({ alias: 'hp' })
health: number = 100;

Released under the MIT License.