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

Method _runSystemPhase

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

* @zh 执行系统的指定阶段 * @en Run specified phase for all systems

(
        systems: EntitySystem[],
        phase: 'update' | 'lateUpdate',
        profileName: string
    )

Source from the content-addressed store, hash-verified

534 * @en Run specified phase for all systems
535 */
536 private _runSystemPhase(
537 systems: EntitySystem[],
538 phase: 'update' | 'lateUpdate',
539 profileName: string
540 ): void {
541 const phaseHandle = ProfilerSDK.beginSample(profileName, ProfileCategory.ECS);
542 try {
543 for (const system of systems) {
544 if (!this._shouldSystemRun(system)) continue;
545
546 const suffix = phase === 'lateUpdate' ? '.late' : '';
547 const systemHandle = ProfilerSDK.beginSample(`${system.systemName}${suffix}`, ProfileCategory.ECS);
548 try {
549 system[phase]();
550 } catch (error) {
551 this._handleSystemError(system, phase, error);
552 } finally {
553 ProfilerSDK.endSample(systemHandle);
554 }
555 }
556 } finally {
557 ProfilerSDK.endSample(phaseHandle);
558 }
559 }
560
561 private _shouldSystemRun(system: EntitySystem): boolean {
562 if (!system.enabled) return false;

Callers 1

updateMethod · 0.95

Calls 4

_shouldSystemRunMethod · 0.95
_handleSystemErrorMethod · 0.95
beginSampleMethod · 0.80
endSampleMethod · 0.80

Tested by

no test coverage detected