Skip to content

ECS Framework API v2.2.13


ECS Framework API / DebugPlugin

Class: DebugPlugin

Defined in: packages/core/src/Plugins/DebugPlugin.ts:93

ECS 调试插件

提供运行时调试功能:

  • 实时查看实体和组件信息
  • System 执行统计
  • 性能监控
  • 实体查询

Example

typescript
const core = Core.create();
const debugPlugin = new DebugPlugin({ autoStart: true, updateInterval: 1000 });
await core.pluginManager.install(debugPlugin);

// 获取调试信息
const stats = debugPlugin.getStats();
console.log('Total entities:', stats.totalEntities);

// 查询实体
const entities = debugPlugin.queryEntities({ tag: 1 });

Implements

Constructors

Constructor

new DebugPlugin(options?): DebugPlugin

Defined in: packages/core/src/Plugins/DebugPlugin.ts:107

创建调试插件实例

Parameters

options?

配置选项

autoStart?

boolean

updateInterval?

number

Returns

DebugPlugin

Properties

name

readonly name: "@esengine/debug-plugin" = '@esengine/debug-plugin'

Defined in: packages/core/src/Plugins/DebugPlugin.ts:94

插件唯一名称

用于依赖解析和插件管理。

Implementation of

IPlugin.name


version

readonly version: "1.0.0" = '1.0.0'

Defined in: packages/core/src/Plugins/DebugPlugin.ts:95

插件版本

遵循语义化版本规范 (semver)。

Implementation of

IPlugin.version

Methods

install()

install(_core, services): Promise<void>

Defined in: packages/core/src/Plugins/DebugPlugin.ts:115

安装插件

Parameters

_core

Core

services

ServiceContainer

Returns

Promise<void>

Implementation of

IPlugin.install


uninstall()

uninstall(): Promise<void>

Defined in: packages/core/src/Plugins/DebugPlugin.ts:128

卸载插件

Returns

Promise<void>

Implementation of

IPlugin.uninstall


dispose()

dispose(): void

Defined in: packages/core/src/Plugins/DebugPlugin.ts:138

实现 IService 接口

Returns

void

Implementation of

IService.dispose


start()

start(): void

Defined in: packages/core/src/Plugins/DebugPlugin.ts:146

启动调试监控

Returns

void


stop()

stop(): void

Defined in: packages/core/src/Plugins/DebugPlugin.ts:162

停止调试监控

Returns

void


getStats()

getStats(): ECSDebugStats

Defined in: packages/core/src/Plugins/DebugPlugin.ts:173

获取当前 ECS 统计信息

Returns

ECSDebugStats


getSceneInfo()

getSceneInfo(scene): SceneDebugInfo

Defined in: packages/core/src/Plugins/DebugPlugin.ts:204

获取场景调试信息

Parameters

scene

IScene

Returns

SceneDebugInfo


getEntityInfo()

getEntityInfo(entity): EntityDebugInfo

Defined in: packages/core/src/Plugins/DebugPlugin.ts:240

获取实体调试信息

Parameters

entity

Entity

Returns

EntityDebugInfo


queryEntities()

queryEntities(filter): EntityDebugInfo[]

Defined in: packages/core/src/Plugins/DebugPlugin.ts:277

查询实体

Parameters

filter

查询过滤器

sceneName?

string

tag?

number

name?

string

hasComponent?

string

Returns

EntityDebugInfo[]


exportJSON()

exportJSON(): string

Defined in: packages/core/src/Plugins/DebugPlugin.ts:354

导出调试数据为 JSON

Returns

string

Released under the MIT License.