Codex与Unity

Codex:

概念:

插件:工具箱;

Skill:工作流说明书,自动流程;

MCP:接工具的通道,工具接口,Model Context Protocol;

插件是Codex 的核心能力来源;

没有插件 = 普通聊天AI

有插件 = 自动干活的AI

安装unity插件:

添加插件市场:

bash 复制代码
# 1. 新增 Unity 官方外掛市集庫
codex plugin marketplace add Unity-Technologies/unity-agent-plugin

# 2. 安裝 Unity 官方插件
codex plugin add unity@unity-agent-plugin

安装unity插件:

使用插件:

在聊天里面@插件名称;

unity-agent-plugin skills:

Unity接入Codex:

1. 编辑器具备MCP:

  1. unity版本为6;

  2. Package Manager安装com.unity.ai.assistant;

  3. 检查MCP:

  1. Codex安装并启用Unity插件后,在unity内接受请求;

CodeGraph(加快ai理解代码):

安装:

bash 复制代码
# Windows (PowerShell)
irm https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.ps1 | iex

# 或者使用node
npm i -g @colbymchenry/codegraph

链接到agent:

在控制台执行:

bash 复制代码
codegraph install

在每个项目初始化:

bash 复制代码
cd your-project
codegraph init

ponytail:

让 AI 编程助手变得更"懒惰"、更高效,从而写出更精简、更安全的代码;

安装:

bash 复制代码
codex plugin marketplace add DietrichGebert/ponytail
codex plugin add ponytail@ponytail

添加信任:

Trellis:

通过自动化机制注入项目规范,让 AI 每次都按你的标准写代码,而不是随机发挥;

安装:

bash 复制代码
# 全局安装(beta 通道)
npm install -g @mindfoldhq/trellis@latest

# 进入你的项目目录
cd your-project

(需要 Node.js 18+ 和 Python 3.9+)

初始化:

trellis init 会自动检测已安装的平台,也可以用 flag 显式指定。每一个平台都需要最少 init 一次。随意组合:

bash 复制代码
# 交互式:检测已安装的平台并询问要配置哪些
trellis init -u your-name

# 显式:配置一个或多个平台
trellis init -u your-name --claude
trellis init -u your-name --claude --cursor --opencode
trellis init -u your-name --codex --gemini
trellis init -u your-name --pi

your-name 会成为你的开发者身份,在 .trellis/workspace/your-name/ 创建个人工作区;

trellis init 为每个平台写入各自的配置目录:

.agents/skills/ 是一份跨平台共享层(agentskills.io 规范);

基本流程:

bash 复制代码
# 1. 描述你要做什么
"新增用户登录功能"

# 2. AI 判断当前 turn,必要时询问是否创建任务

# 3. 如果这是 Trellis task,AI 按 workflow.md 走 Plan → Execute → Finish

# 4. 工作 commit 已存在后
/trellis:finish-work

目录结构:

bash 复制代码
your-project/
├── .trellis/                          # Trellis 核心(跨平台一致)
│   ├── .developer                     # 开发者身份(gitignored)
│   ├── .version                       # Trellis 版本号
│   ├── .template-hashes.json          # 模板文件 hash(update 用)
│   ├── workflow.md                    # 开发工作流指南
│   ├── config.yaml                    # 项目配置(packages、update.skip、hooks)
│   │
│   ├── .runtime/                      # 每个会话自己的运行时状态(gitignored)
│   │   └── sessions/                  #   每个 AI 会话/窗口对应一个 active task
│   │       └── <session-key>.json
│   │
│   ├── spec/                          # 项目 spec 库
│   │   ├── frontend/                  #   前端 spec(monorepo 可按 package 分层)
│   │   ├── backend/                   #   后端 spec
│   │   └── guides/                    #   思考指南
│   │
│   ├── workspace/                     # 开发者工作区
│   │   ├── index.md
│   │   └── {developer-name}/
│   │       ├── index.md
│   │       └── journal-N.md
│   │
│   ├── tasks/                         # 任务目录
│   │   ├── {MM-DD-task-name}/         #   活跃任务
│   │   │   ├── task.json              #     任务元信息
│   │   │   ├── prd.md                 #     需求文档
│   │   │   ├── design.md              #     复杂任务的技术设计
│   │   │   ├── implement.md           #     复杂任务的实施计划
│   │   │   ├── implement.jsonl        #     实现阶段 spec/research manifest
│   │   │   ├── check.jsonl            #     review 阶段 spec/research manifest
│   │   │   └── research/              #     持久调研记录
│   │   └── archive/                   #   归档任务
│   │       └── {YYYY-MM}/
│   │
│   └── scripts/                       # 自动化脚本(Python)
│       ├── task.py                    #   任务管理
│       ├── get_context.py             #   会话上下文
│       ├── add_session.py             #   记录会话
│       ├── create_bootstrap.py        #   首次 spec bootstrap
│       └── common/                    #   共享库
│
├── .claude/                           # Claude Code 配置
│   ├── settings.json                  #   hook 和权限配置
│   ├── commands/trellis/              #   显式命令
│   │   ├── start.md
│   │   ├── finish-work.md
│   │   └── continue.md
│   ├── agents/                        #   Sub-agent 定义
│   │   ├── trellis-implement.md
│   │   ├── trellis-check.md
│   │   └── trellis-research.md
│   ├── skills/                        #   Auto-trigger skills
│   │   ├── trellis-brainstorm/
│   │   ├── trellis-before-dev/
│   │   ├── trellis-check/
│   │   ├── trellis-update-spec/
│   │   └── trellis-break-loop/
│   └── hooks/                         #   Hook 脚本
│       ├── session-start.py
│       ├── inject-subagent-context.py
│       └── inject-workflow-state.py
│
├── .cursor/           # Cursor:commands/ + rules/
├── .opencode/         # OpenCode:commands/trellis/、agents/、skills/、plugins/
├── .codex/            # Codex:prompts/、skills/ + 仓库根 AGENTS.md
├── .kiro/             # Kiro:steering/、prompts/、skills/
├── .gemini/           # Gemini CLI:commands/trellis/
├── .qoder/            # Qoder:commands/、skills/、agents/、hooks/
├── .codebuddy/        # CodeBuddy:commands/trellis/
├── .factory/          # Droid:commands/trellis/、skills/、hooks/
├── .pi/               # Pi Agent:prompts/、skills/、agents/、extensions/trellis/
└── .github/           # Copilot:copilot-instructions.md、prompts/

启动会话:

在 ~/.codex/config.toml 开启 hook,否则聊天界面输入 / 检索不到 Trellis 的三大命令(/start、/finish-work、/continue),也无法用 /start 启动会话

bash 复制代码
[features]
hooks = true   # Codex 0.129+。旧版用 `codex_hooks = true`。
相关推荐
淡海水2 小时前
01-03-认知篇-C#内存模型深度解析
unity·c#·游戏引擎·.net·gc
警醒与鞭策11 小时前
Direct3D 12 中的内存管理
3d·游戏引擎·direct3d
淡海水15 小时前
16-02-C#常用数据结构源码-附录B-源码索引速查
unity·c#·游戏引擎·il2cpp
速易达网络16 小时前
无人机远程操控仿真
游戏引擎·cocos2d
郝学胜-神的一滴17 小时前
游戏引擎原理与实践 02:揭开3A游戏背后的技术面纱
开发语言·计算机网络·程序人生·游戏·游戏引擎
警醒与鞭策1 天前
【无标题】
android·unity·性能优化·游戏引擎·perforce
zhchyun20081 天前
【Unity UI 进阶】仿 Element UI 打造企业级 Unity UI 组件库(10)
ui·unity·游戏引擎
地狱为王1 天前
Unity使用NVIDIA的Audio2Face驱动口型
unity·游戏引擎
ebiobiz1 天前
STM32F4 Unity 单元测试与多次测试失败率统计详细步骤
stm32·unity·单元测试