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:
YHH
2025-12-30 16:57:11 +08:00
committed by GitHub
parent d9969d0b08
commit 04b08f3f07
2 changed files with 8 additions and 0 deletions

View File

@@ -478,6 +478,7 @@ export class Entity {
this.scene.eventSystem.emitSync(ECSEventType.COMPONENT_ADDED, {
timestamp: Date.now(),
source: 'Entity',
entity: this,
entityId: this.id,
entityName: this.name,
entityTag: this.tag?.toString(),