Skip to Content

施工中

这一篇还在编写,内容与示例随时可能变动。

组件(Component)

component 声明 ECS 组件:一份纯数据(POD)的存储单元,只有字段、没有行为,由 query 按类型筛选实体并读写。

组件数据存放在宿主的原生存储中,脚本侧不存在「组件值」,它只在 query 的变量视图中出现。

声明形态

模块顶层声明,可见性 public / internal 二档:

module EcsDemo; public component Position { public var X: float; public var Y: float; } public component Velocity { public var X: float = 0.0; } public component Enemy;

编写到此Written up to here

本页其余部分尚未完成,内容随时补充。The rest of this page is not written yet; more content will follow.

最后更新于 2026年10月10日