UE DataTable Editor
Edit Unreal Engine DataTable configuration through JSON files — auto-discover projects, search, modify, validate, and import back to the engine.
Overview
UE projects commonly store DataTable data in .uasset files, with corresponding JSON source files that serve as the editable representation. This skill provides a complete workflow for discovering, modifying, and re-importing these data tables.
This skill works with any UE project — it automatically detects the project structure and locates DataTable JSON files. No hardcoded paths required.
Supported DataTable Format
The JSON file should be an array of objects, each with a Name field as the row key:
CODEBLOCK0
Important Notes
- - JSON files may be encoded in UTF-16 LE (with BOM), UTF-8 BOM, or UTF-8. All scripts handle encoding automatically.
- The
.uasset files are binary and cannot be edited directly — always modify through JSON then import.
Workflow
Step 0: Discover UE Project and DataTable Files
ALWAYS run this step first when the user has not provided a specific JSON path. Use scripts/dt_discover.py to auto-detect UE projects and DataTable JSON files:
CODEBLOCK1
When the user provides a table name (e.g. "修改 AI_Skills 表"), use --table to locate the matching JSON file:
CODEBLOCK2
Once the JSON file is identified, store its absolute path for use in subsequent steps.
Step 1: Search for Target Rows
Use scripts/dt_search.py to locate the row(s) to modify. The --json parameter takes the path discovered in Step 0.
CODEBLOCK3
Present search results to the user before proceeding with modifications.
Step 2: Modify Data
Use scripts/dt_modify.py to modify fields. The script automatically:
- - Wraps plain text in
NSLOCTEXT() format for localization fields - Validates all data after modification
- Creates a timestamped backup before saving
CODEBLOCK4
NSLOCTEXT Format Rules
For localization fields (LOC_Name, LOC_Desc, LOC_AlertText, LOC_InterruptMessage, LOC_NoticeText):
- - When user provides plain text, the script auto-wraps it as: INLINECODE14
- When user provides a full
NSLOCTEXT(...) or INVTEXT(...) string, it is used as-is - Use
--no-wrap flag to disable auto-wrapping
Field Modification via Direct File Edit
For complex modifications (nested objects, arrays, or bulk changes), directly edit the JSON file using replace_in_file or read_file + write_to_file tools. Always validate after editing:
CODEBLOCK5
Step 3: Import into UE Engine
After modifying and validating the JSON, generate the UE import command. The user must execute this command in the UE Editor Output Log:
CODEBLOCK6
Parameters:
- -
--part 0 — Import Part0 (ID 200000–229999) - INLINECODE22 — Import Part1 (ID 230000–239999)
- INLINECODE23 — Import Part2 (ID 240000–249999)
- INLINECODE24 — Import all Parts
- INLINECODE25 — Override the UE asset base path (default:
/Game/SMG/Configs/DataTables/AISkills)
Determine the correct --part number from the row ID being modified. Always provide the full command with absolute paths for the user to copy-paste.
Step 4: Verify
After the user reports the UE import result, check the log output for:
- -
Imported DataTable '...' - 0 Problems = Success - Any
Error lines = Investigation needed
Refer to references/field_schema.md for the complete field documentation when needed.
Quick Start Example
User says: "修改 AI_Skills 表中技能 230005 的描述"
- 1. Discover: INLINECODE31
→ Found: INLINECODE32
- 2. Search: INLINECODE33
→ Shows current skill data
- 3. Modify: INLINECODE34
→ Modifies and validates
- 4. Import: Provide UE command for the user to run in editor
Error Handling
| Error | Cause | Solution |
|---|
| No UE project found | Project not in search paths | Use --root to specify project directory |
| No DataTable JSON found |
JSON file not in Content directory | Check project structure, provide path manually |
|
UnicodeDecodeError | Wrong encoding detection | Scripts auto-detect; if issues persist, check file BOM bytes |
|
fill_data_table_from_json_string fails | JSON fields don't match RowStruct | Validate JSON, check for missing/extra fields |
|
DataTable not found | Wrong asset path | Use
--asset-base to specify correct UE asset path |
| P4 checkout failure | File locked by another user | Coordinate with team or force checkout |
UE DataTable 编辑器
通过JSON文件编辑虚幻引擎DataTable配置 — 自动发现项目、搜索、修改、验证并导回引擎。
概述
UE项目通常将DataTable数据存储在.uasset文件中,同时存在对应的JSON源文件作为可编辑表示形式。本技能提供了一套完整的发现、修改和重新导入这些数据表的工作流程。
本技能适用于任何UE项目 — 它会自动检测项目结构并定位DataTable JSON文件。无需硬编码路径。
支持的DataTable格式
JSON文件应为一个对象数组,每个对象包含一个Name字段作为行键:
json
[
{ Name: 230000, DevName: 技能名, LOC_Name: NSLOCTEXT(...), ... },
{ Name: 230001, ... }
]
重要说明
- - JSON文件可能采用UTF-16 LE(带BOM)、UTF-8 BOM或UTF-8编码。所有脚本会自动处理编码问题。
- .uasset文件为二进制格式,无法直接编辑 — 始终通过修改JSON后再导入。
工作流程
步骤0:发现UE项目和DataTable文件
当用户未提供具体JSON路径时,始终先执行此步骤。使用scripts/dt_discover.py自动检测UE项目和DataTable JSON文件:
bash
自动发现常见位置的所有UE项目和DataTable JSON文件
python {SKILL
DIR}/scripts/dtdiscover.py
在指定目录中搜索
python {SKILL
DIR}/scripts/dtdiscover.py --root <目录>
按名称查找特定表(匹配JSON文件名)
python {SKILL
DIR}/scripts/dtdiscover.py --table AI_Skills
按UE项目名称筛选
python {SKILL
DIR}/scripts/dtdiscover.py --project SMG
以JSON格式输出以便解析
python {SKILL
DIR}/scripts/dtdiscover.py --json-output
当用户提供表名时(例如修改 AI_Skills 表),使用--table定位匹配的JSON文件:
bash
python {SKILLDIR}/scripts/dtdiscover.py --table <用户提供的表名>
确定JSON文件后,存储其绝对路径以供后续步骤使用。
步骤1:搜索目标行
使用scripts/dt_search.py定位要修改的行。--json参数使用步骤0中发现的路径。
bash
按行ID搜索
python {SKILL
DIR}/scripts/dtsearch.py --json
--id 230000
按名称关键字搜索
python {SKILLDIR}/scripts/dtsearch.py --json --name 蓄力
按任意字段搜索
python {SKILLDIR}/scripts/dtsearch.py --json --field DevName --value 瞬移
列出某个Part中的所有行(适用于AI Skills表)
python {SKILLDIR}/scripts/dtsearch.py --json --part 1
显示结果的完整JSON
python {SKILLDIR}/scripts/dtsearch.py --json --id 230000 --full
列出所有可用字段
python {SKILLDIR}/scripts/dtsearch.py --json --list-fields
在进行修改前,向用户展示搜索结果。
步骤2:修改数据
使用scripts/dt_modify.py修改字段。脚本会自动:
- - 将纯文本包装为NSLOCTEXT()格式(针对本地化字段)
- 修改后验证所有数据
- 保存前创建带时间戳的备份
bash
修改LOC_Desc(自动包装为NSLOCTEXT)
python {SKILLDIR}/scripts/dtmodify.py --json --id 230000 --set-loc-desc 对随机角色造成伤害
修改LOC_Name
python {SKILLDIR}/scripts/dtmodify.py --json --id 230000 --set-loc-name 新技能名
修改任意字段
python {SKILLDIR}/scripts/dtmodify.py --json --id 230000 --set bUseAlert=true --set DevName=新名称
预览但不保存(试运行)
python {SKILLDIR}/scripts/dtmodify.py --json --id 230000 --set-loc-desc 测试 --dry-run
验证整个JSON
python {SKILLDIR}/scripts/dtmodify.py --json --validate
NSLOCTEXT格式规则
对于本地化字段(LOCName、LOCDesc、LOCAlertText、LOCInterruptMessage、LOC_NoticeText):
- - 当用户提供纯文本时,脚本会自动包装为:NSLOCTEXT(, _, )
- 当用户提供完整的NSLOCTEXT(...)或INVTEXT(...)字符串时,按原样使用
- 使用--no-wrap标志禁用自动包装
通过直接文件编辑修改字段
对于复杂修改(嵌套对象、数组或批量更改),使用replaceinfile或readfile + writeto_file工具直接编辑JSON文件。编辑后始终进行验证:
bash
python {SKILLDIR}/scripts/dtmodify.py --json --validate
步骤3:导入UE引擎
修改并验证JSON后,生成UE导入命令。用户必须在UE编辑器输出日志中执行此命令:
py {SKILLDIR}/scripts/dtimport_ue.py --json --part <分区编号>
参数:
- - --part 0 — 导入Part0(ID 200000–229999)
- --part 1 — 导入Part1(ID 230000–239999)
- --part 2 — 导入Part2(ID 240000–249999)
- --part all — 导入所有Part
- --asset-base <路径> — 覆盖UE资源基础路径(默认:/Game/SMG/Configs/DataTables/AISkills)
根据正在修改的行ID确定正确的--part编号。 始终提供包含绝对路径的完整命令供用户复制粘贴。
步骤4:验证
用户报告UE导入结果后,检查日志输出:
- - Imported DataTable ... - 0 Problems = 成功
- 任何Error行 = 需要调查
需要时,请参考references/field_schema.md获取完整的字段文档。
快速入门示例
用户说:修改 AI_Skills 表中技能 230005 的描述
- 1. 发现:python {SKILLDIR}/scripts/dtdiscover.py --table AI_Skills
→ 找到:D:\Projects\MyGame\Content\Configs\Json\JsonAISkills.json
- 2. 搜索:python {SKILLDIR}/scripts/dtsearch.py --json <找到的路径> --id 230005
→ 显示当前技能数据
- 3. 修改:python {SKILLDIR}/scripts/dtmodify.py --json <找到的路径> --id 230005 --set-loc-desc 新的描述文本
→ 修改并验证
- 4. 导入:提供UE命令供用户在编辑器中运行
错误处理
| 错误 | 原因 | 解决方案 |
|---|
| 未找到UE项目 | 项目不在搜索路径中 | 使用--root指定项目目录 |
| 未找到DataTable JSON |
JSON文件不在Content目录中 | 检查项目结构,手动提供路径 |
| UnicodeDecodeError | 编码检测错误 | 脚本自动检测;如问题持续,检查文件BOM字节 |
| filldatatablefromjson_string失败 | JSON字段与RowStruct不匹配 | 验证JSON,检查缺少/多余字段 |
| DataTable not found | 资源路径错误 | 使用--asset-base指定正确的UE资源路径 |
| P4签出失败 | 文件被其他用户锁定 | 与团队协调或强制签出 |