fix(ecs): add entity field to COMPONENT_ADDED event (#396)
Fix missing entity field in COMPONENT_ADDED event payload that caused ECSRoom's @NetworkEntity auto-broadcast to fail with 'Cannot read properties of undefined'
This commit is contained in:
7
.changeset/fix-component-added-entity.md
Normal file
7
.changeset/fix-component-added-entity.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"@esengine/ecs-framework": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(ecs): COMPONENT_ADDED 事件添加 entity 字段
|
||||||
|
|
||||||
|
修复 `ECSEventType.COMPONENT_ADDED` 事件缺少 `entity` 字段的问题,导致 ECSRoom 的 `@NetworkEntity` 自动广播功能报错。
|
||||||
@@ -478,6 +478,7 @@ export class Entity {
|
|||||||
this.scene.eventSystem.emitSync(ECSEventType.COMPONENT_ADDED, {
|
this.scene.eventSystem.emitSync(ECSEventType.COMPONENT_ADDED, {
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
source: 'Entity',
|
source: 'Entity',
|
||||||
|
entity: this,
|
||||||
entityId: this.id,
|
entityId: this.id,
|
||||||
entityName: this.name,
|
entityName: this.name,
|
||||||
entityTag: this.tag?.toString(),
|
entityTag: this.tag?.toString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user