Home > @esengine/ecs-framework-monorepo > QuerySystem > batchUpdateComponents
QuerySystem.batchUpdateComponents() method
批量更新实体组件
对大量实体进行批量组件更新操作。
Signature:
typescript
batchUpdateComponents(updates: Array<{
entityId: number;
componentMask: bigint;
}>): void;
Parameters
Parameter | Type | Description |
---|---|---|
updates | Array<{ entityId: number; componentMask: bigint; }> | 更新操作列表,包含实体ID和新的组件掩码 |
Returns:
void
Example
typescript
// 批量更新实体的组件配置
const updates = [
{ entityId: 1, componentMask: BigInt(0b1011) },
{ entityId: 2, componentMask: BigInt(0b1101) }
];
querySystem.batchUpdateComponents(updates);