ECS:Entitas 入门 Hello World
发表于2019-12-09
概述
基于官方的Hello World教程,熟悉Entitas插件的使用。
第一步:搭建环境
1.创建U3D工程
2.下载 Entitas-Unity.zip
3.把插件拷贝到工程里
4.在工程里创建文件夹 Source
![DcGwturYDrU5DSUCCBk5.png](https://tigimg-1252093452.image.myqcloud.com/2019/12/09/DcGwturYDrU5DSUCCBk5.png)
第二步:配置代码生成工具
1.打开:Tools->Entitas->Preferences,指定生成路径
![qPu9G2xzzm8bINwBaWBU.png](https://tigimg-1252093452.image.myqcloud.com/2019/12/09/qPu9G2xzzm8bINwBaWBU.png)
2.打开 Tools->Jenny->Preferences,
![V1WYIviNR4HiVa0lJP1R.png](https://tigimg-1252093452.image.myqcloud.com/2019/12/09/V1WYIviNR4HiVa0lJP1R.png)
结果:
![SLs8qhwN157n4Q9bIk2I.jpg](https://tigimg-1252093452.image.myqcloud.com/2019/12/09/SLs8qhwN157n4Q9bIk2I.jpg)
第三步:创建Component
在Assets/Source/Components目录下创建 DebugMessageComponent.cs 脚本
using Entitas;
[Game]
public class DebugMessageComponent : IComponent
{
public string message;
}
点击Generate按钮生成代码,GameDebugMessageComponent.cs,Component是写模板然后用工具生成
【腾讯尽然对文章的长度有限制,这里省略代码,看官方原版代码即可】
第四步:创建System
1.DebugMessageSystem:
2.HelloWorldSystem:
第五步:注册System
第六步:控制脚本
![smxCneITYRNblqrhPDsD.png](https://tigimg-1252093452.image.myqcloud.com/2019/12/09/smxCneITYRNblqrhPDsD.png)
参考:
https://github.com/sschmid/Entitas-CSharp/wiki/Unity-Tutorial-Hello-World
https://github.com/FNGgames/Entitas-Hello-World-Unity-Example