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

Method end

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

* 结束场景,清除实体、实体处理器等 * * 这个方法会结束场景。它将移除所有实体,结束实体处理器等,并调用unload方法。 * * 执行顺序: * 1. 调用 unload() - 用户可以在此访问实体和系统进行清理 * 2. 清理所有实体 * 3. 清空服务容器,触发所有系统的 onDestroy() * * 注意: * - onRemoved 回调不会在 Scene.end() 时触发,因为这是批量销毁场景 * - 用户清理:在 Scene.unload() 中处理(可访问实体

()

Source from the content-addressed store, hash-verified

492 * - 系统清理:在 System.onDestroy() 中处理(实体已被清理)
493 */
494 public end() {
495 this._didSceneBegin = false;
496 this.unload();
497 this.entities.removeAllEntities();
498 this.querySystem.setEntities([]);
499 this.componentStorageManager.clear();
500 this._services.clear();
501 this._cachedSystems = null;
502 this._systemsOrderDirty = true;
503 this._componentIdToSystems.clear();
504 this._globalNotifySystems.clear();
505 this._handleToEntity.clear();
506 this.handleManager.reset();
507 this.epochManager.reset();
508 }
509
510 /**
511 * 更新场景

Callers 4

handleCloseProjectFunction · 0.45
useProjectActionsFunction · 0.45
removeSceneMethod · 0.45
destroyFunction · 0.45

Calls 5

unloadMethod · 0.95
clearMethod · 0.65
resetMethod · 0.65
removeAllEntitiesMethod · 0.45
setEntitiesMethod · 0.45

Tested by

no test coverage detected