MCPcopy Create free account
hub / github.com/esengine/esengine / createEntity

Method createEntity

packages/core/src/ECS/Scene.ts:622–632  ·  view source on GitHub ↗

* 将实体添加到此场景,并返回它 * @param name 实体名称

(name: string)

Source from the content-addressed store, hash-verified

620 * @param name 实体名称
621 */
622 public createEntity(name: string) {
623 const entity = new Entity(name, this.identifierPool.checkOut());
624
625 const handle = this.handleManager.create();
626 entity.setHandle(handle);
627 this._handleToEntity.set(handle, entity);
628
629 this.eventSystem.emitSync('entity:created', { entityName: name, entity, scene: this });
630
631 return this.addEntity(entity);
632 }
633
634 /**
635 * 清除所有EntitySystem的实体缓存

Callers

nothing calls this directly

Calls 6

setHandleMethod · 0.95
addEntityMethod · 0.95
setMethod · 0.65
checkOutMethod · 0.45
createMethod · 0.45
emitSyncMethod · 0.45

Tested by

no test coverage detected