49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
---
|
||
description: NLD 项目通用 AI 编码规则 - 定义代码风格、设计原则和开发规范。适用于所有代码编写和修改任务。
|
||
alwaysApply: true
|
||
---
|
||
|
||
# 在执行大量代码修改之前,先和用户确认设计思路再继续执行
|
||
|
||
# 编码要求
|
||
使用面向对象的设计思路
|
||
单个文件/模块尽可能小且功能单一
|
||
|
||
## 一般准则
|
||
- 按要求去做,不扩展额外的功能
|
||
- 不要生成unity的meta文件,留给unity自己生成
|
||
|
||
## 编辑器开发
|
||
- 使用Odin工具开发编辑器
|
||
|
||
## git操作
|
||
- 除非用户要求,AI不做任何git提交相关操作
|
||
- 当用户让AI操作git时提醒用户git操作有风险
|
||
|
||
## Error Handling and Debugging
|
||
- Implement error handling using try-catch blocks where appropriate, especially for file I/O and network operations.
|
||
- Use DebugUtil class for logging and debugging.
|
||
- Utilize Unity's profiler and frame debugger to identify and resolve performance issues.
|
||
|
||
## UI Prefab 信息获取
|
||
|
||
当需要了解 UI Prefab 的结构和组件信息时,按以下步骤操作:
|
||
|
||
1. 通过 Unity MCP 调用 `extract_ui_prefab` 工具:
|
||
```
|
||
execute_custom_tool: { tool_name: "extract_ui_prefab", parameters: { prefab_path: "Assets/xxx/xxx.prefab" } }
|
||
```
|
||
2. 读取返回的 `json_path` 对应的 JSON 文件
|
||
3. 参考 `ExtractedPrefabs/README.md` 理解 JSON 格式含义
|
||
4. 基于 JSON 内容分析 UI 层级结构、组件类型和属性
|
||
|
||
**重要**:每次都需要先调用工具生成 JSON(避免读取旧数据)
|
||
|
||
**适用场景**:
|
||
- 需要理解某个 UI 界面的布局结构
|
||
- 需要了解 UI 组件的具体属性配置
|
||
- 需要分析或修改 UI Prefab 相关代码
|
||
|
||
- You can @ files here
|
||
- You can use markdown but dont have to
|