unity-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow Skills

工作流技能

Persistent history and rollback system for AI operations ("Time Machine"). Allows tagging tasks, snapshotting objects before modification, and undoing specific tasks even after Editor restarts.
NEW: Session-level undo - Group all changes from a conversation and undo them together.
适用于AI操作的持久化历史与回滚系统("时光机")。 支持为任务添加标签、在修改前为对象创建快照,甚至在编辑器重启后仍可撤销特定任务。
新增:会话级撤销 - 将一次对话中的所有变更分组,可一次性撤销所有变更。

Guardrails

约束规则

Mode: Semi-Auto (available by default)
DO NOT (common hallucinations):
  • workflow_save
    does not exist → use
    workflow_task_end
    to end and save a task
  • workflow_rollback
    does not exist → use
    workflow_undo_task
    (by taskId) or
    workflow_session_undo
    (by sessionId)
  • workflow_create
    does not exist → use
    workflow_task_start
  • workflow_revert_task
    is deprecated → use
    workflow_undo_task
Routing:
  • For simple undo/redo (1 step) →
    editor_undo
    /
    editor_redo
    (editor module)
  • For multi-step undo →
    history_undo
    with
    steps
    parameter (this module)
  • For conversation-level undo →
    workflow_session_undo
    (this module)
模式:半自动(默认启用)
禁止操作(常见错误):
  • workflow_save
    不存在 → 请使用
    workflow_task_end
    来结束并保存任务
  • workflow_rollback
    不存在 → 请使用
    workflow_undo_task
    (通过taskId)或
    workflow_session_undo
    (通过sessionId)
  • workflow_create
    不存在 → 请使用
    workflow_task_start
  • workflow_revert_task
    已废弃 → 请使用
    workflow_undo_task
路由规则
  • 简单的撤销/重做(单步)→ 使用
    editor_undo
    /
    editor_redo
    (编辑器模块)
  • 多步撤销 → 使用本模块的
    history_undo
    并传入
    steps
    参数
  • 对话级撤销 → 使用本模块的
    workflow_session_undo

Bookmark Skills

书签技能

bookmark_set

bookmark_set

Save current selection and scene view position as a bookmark.
ParameterTypeRequiredDefaultDescription
bookmarkNamestringYes-Name for the bookmark
notestringNonullOptional note for the bookmark
Returns:
{ success, bookmark, selectedCount, hasSceneView, note }
将当前选择的对象和场景视图位置保存为书签。
参数类型必填默认值描述
bookmarkNamestring-书签名称
notestringnull书签的可选备注
返回值:
{ success, bookmark, selectedCount, hasSceneView, note }

bookmark_goto

bookmark_goto

Restore selection and scene view from a bookmark.
ParameterTypeRequiredDefaultDescription
bookmarkNamestringYes-Name of the bookmark to restore
Returns:
{ success, bookmark, restoredSelection, note }
从书签恢复选择的对象和场景视图。
参数类型必填默认值描述
bookmarkNamestring-要恢复的书签名称
返回值:
{ success, bookmark, restoredSelection, note }

bookmark_list

bookmark_list

List all saved bookmarks.
No parameters.
Returns:
{ success, count, bookmarks: [{ name, selectedCount, hasSceneView, note, createdAt }] }
列出所有已保存的书签。
无参数。
返回值:
{ success, count, bookmarks: [{ name, selectedCount, hasSceneView, note, createdAt }] }

bookmark_delete

bookmark_delete

Delete a bookmark.
ParameterTypeRequiredDefaultDescription
bookmarkNamestringYes-Name of the bookmark to delete
Returns:
{ success, deleted }
删除一个书签。
参数类型必填默认值描述
bookmarkNamestring-要删除的书签名称
返回值:
{ success, deleted }

History Skills

历史技能

history_undo

history_undo

Undo the last operation (or multiple steps).
ParameterTypeRequiredDefaultDescription
stepsintNo1Number of undo steps to perform
Returns:
{ success, undoneSteps }
撤销最后一次操作(或多步操作)。
参数类型必填默认值描述
stepsint1要执行的撤销步数
返回值:
{ success, undoneSteps }

history_redo

history_redo

Redo the last undone operation (or multiple steps).
ParameterTypeRequiredDefaultDescription
stepsintNo1Number of redo steps to perform
Returns:
{ success, redoneSteps }
重做最后一次被撤销的操作(或多步操作)。
参数类型必填默认值描述
stepsint1要执行的重做步数
返回值:
{ success, redoneSteps }

history_get_current

history_get_current

Get the name of the current undo group.
No parameters.
Returns:
{ success, currentGroup, groupIndex }
获取当前撤销组的名称。
无参数。
返回值:
{ success, currentGroup, groupIndex }

Planning And Batch Governance

规划与批量治理

workflow_plan

workflow_plan

Generate a combined execution plan for multiple skills on the server side.
ParameterTypeRequiredDefaultDescription
skillsJson
stringYes-JSON array of
{ "name": "...", "params": { ... } }
entries
Returns:
{ totalSteps, totalRisk, steps, dependencies, warnings, mayDisconnect }
在服务器端为多个技能生成组合执行计划。
参数类型必填默认值描述
skillsJson
string-包含
{ "name": "...", "params": { ... } }
条目的JSON数组
返回值:
{ totalSteps, totalRisk, steps, dependencies, warnings, mayDisconnect }

batch_query_assets

batch_query_assets

Query project assets with filters that are useful before batch cleanup or migration work.
ParameterTypeRequiredDefaultDescription
searchFilter
stringNo-Extra
AssetDatabase.FindAssets
filter text
folder
stringNo
Assets
Search root
typeFilter
stringNo-Asset type filter such as
t:Material
or
Prefab
namePattern
stringNo-Regex applied to file name without extension
labelFilter
stringNo-Asset label filter such as
l:Addressable
maxResults
intNo
200
Max assets returned
Returns:
{ count, totalMatched, summary, assets }
在批量清理或迁移工作前,使用筛选条件查询项目资产。
参数类型必填默认值描述
searchFilter
string-
AssetDatabase.FindAssets
的额外筛选文本
folder
string
Assets
搜索根目录
typeFilter
string-资产类型筛选器,如
t:Material
Prefab
namePattern
string-应用于不带扩展名的文件名的正则表达式
labelFilter
string-资产标签筛选器,如
l:Addressable
maxResults
int
200
返回的最大资产数量
返回值:
{ count, totalMatched, summary, assets }

batch_retry_failed

batch_retry_failed

Retry only the failed items from an earlier batch execution report. This now reuses the original operation context stored in the report.
ParameterTypeRequiredDefaultDescription
reportId
stringYes-Source report ID from
batch_report_get
/
batch_report_list
runAsync
boolNo
true
Return a
jobId
immediately or wait for completion
chunkSize
intNo
100
Chunk size for retry execution
Returns:
{ status, jobId?, retryCount, originalReportId, reportId? }
仅重试之前批量执行报告中的失败项。现在会重用报告中存储的原始操作上下文。
参数类型必填默认值描述
reportId
string-来自
batch_report_get
/
batch_report_list
的源报告ID
runAsync
bool
true
立即返回
jobId
或等待执行完成
chunkSize
int
100
重试执行的块大小
返回值:
{ status, jobId?, retryCount, originalReportId, reportId? }

Session Management (Conversation-Level Undo)

会话管理(对话级撤销)

workflow_session_start

workflow_session_start

Start a new session (conversation-level). All changes will be tracked and can be undone together. Call this at the beginning of each conversation.
ParameterTypeRequiredDefaultDescription
tagstringNonullLabel for the session
Returns:
{ success, sessionId, message }
启动一个新的会话(对话级)。所有变更将被追踪,可一次性撤销。 请在每次对话开始时调用此函数。
参数类型必填默认值描述
tagstringnull会话的标签
返回值:
{ success, sessionId, message }

workflow_session_end

workflow_session_end

End the current session and save all tracked changes. Call this at the end of each conversation.
No parameters.
Returns:
{ success, sessionId, message }
结束当前会话并保存所有追踪的变更。 请在每次对话结束时调用此函数。
无参数。
返回值:
{ success, sessionId, message }

workflow_session_undo

workflow_session_undo

Undo all changes made during a specific session (conversation-level undo).
ParameterTypeRequiredDefaultDescription
sessionIdstringNonullThe UUID of the session to undo. If not provided, undoes the most recent session
Returns:
{ success, sessionId, message }
撤销特定会话中所做的所有变更(对话级撤销)。
参数类型必填默认值描述
sessionIdstringnull要撤销的会话UUID。如果未提供,则撤销最近的会话
返回值:
{ success, sessionId, message }

workflow_session_list

workflow_session_list

List all recorded sessions (conversation-level history).
No parameters.
Returns:
{ success, count, currentSessionId, sessions: [{ sessionId, taskCount, totalChanges, startTime, endTime, tags }] }
列出所有已记录的会话(对话级历史)。
无参数。
返回值:
{ success, count, currentSessionId, sessions: [{ sessionId, taskCount, totalChanges, startTime, endTime, tags }] }

workflow_session_status

workflow_session_status

Get the current session status.
No parameters.
Returns:
{ success, hasActiveSession, currentSessionId, isRecording, currentTaskId, currentTaskTag, currentTaskDescription, snapshotCount }
获取当前会话状态。
无参数。
返回值:
{ success, hasActiveSession, currentSessionId, isRecording, currentTaskId, currentTaskTag, currentTaskDescription, snapshotCount }

Task-Level Skills

任务级技能

workflow_task_start

workflow_task_start

Start a new persistent workflow task to track changes for undo. Call workflow_task_end when done.
ParameterTypeRequiredDefaultDescription
tagstringYes-Short label for the task (e.g., "Create NPC")
descriptionstringNo""Detailed description or prompt
Returns:
{ success, taskId, message }
启动一个新的持久化工作流任务,用于追踪变更以便撤销。完成后请调用workflow_task_end。
参数类型必填默认值描述
tagstring-任务的短标签(例如:"创建NPC")
descriptionstring""详细描述或提示词
返回值:
{ success, taskId, message }

workflow_task_end

workflow_task_end

End the current workflow task and save it. Requires an active task (call workflow_task_start first).
No parameters.
Returns:
{ success, taskId, snapshotCount, message }
结束当前工作流任务并保存。需要存在活跃任务(需先调用workflow_task_start)。
无参数。
返回值:
{ success, taskId, snapshotCount, message }

workflow_snapshot_object

workflow_snapshot_object

Manually snapshot an object's state before modification. Requires an active task (call workflow_task_start first). Call this BEFORE
component_set_property
,
gameobject_set_transform
, etc.
ParameterTypeRequiredDefaultDescription
namestringNonullName of the Game Object
instanceIdintNo0Instance ID of the object (preferred)
Returns:
{ success, objectName, type }
在修改前手动为对象状态创建快照。需要存在活跃任务(需先调用workflow_task_start)。 请在调用
component_set_property
gameobject_set_transform
等函数之前调用此函数。
参数类型必填默认值描述
namestringnull游戏对象的名称
instanceIdint0对象的实例ID(优先使用)
返回值:
{ success, objectName, type }

workflow_snapshot_created

workflow_snapshot_created

Record a newly created object for undo tracking. Requires an active task (call workflow_task_start first). Note:
component_add
and
gameobject_create
automatically record created objects, so you typically don't need to call this manually.
ParameterTypeRequiredDefaultDescription
namestringNonullName of the Game Object
instanceIdintNo0Instance ID of the object (preferred)
Returns:
{ success, objectName, type }
记录新创建的对象以便追踪撤销。需要存在活跃任务(需先调用workflow_task_start)。 注意:
component_add
gameobject_create
会自动记录创建的对象,因此通常无需手动调用此函数。
参数类型必填默认值描述
namestringnull游戏对象的名称
instanceIdint0对象的实例ID(优先使用)
返回值:
{ success, objectName, type }

workflow_list

workflow_list

List persistent workflow history.
No parameters.
Returns:
{ success, count, history: [{ id, tag, description, time, changes }] }
列出持久化工作流历史。
无参数。
返回值:
{ success, count, history: [{ id, tag, description, time, changes }] }

workflow_undo_task

workflow_undo_task

Undo changes from a specific task (restore to previous state). The undone task is saved and can be redone later.
ParameterTypeRequiredDefaultDescription
taskIdstringYes-The UUID of the task to undo
Returns:
{ success, taskId }
撤销特定任务的变更(恢复到之前的状态)。被撤销的任务会被保存,之后可重做。
参数类型必填默认值描述
taskIdstring-要撤销的任务UUID
返回值:
{ success, taskId }

workflow_redo_task

workflow_redo_task

Redo a previously undone task (restore changes).
ParameterTypeRequiredDefaultDescription
taskIdstringNonullThe UUID of the task to redo. If not provided, redoes the most recently undone task
Returns:
{ success, taskId }
重做之前被撤销的任务(恢复变更)。
参数类型必填默认值描述
taskIdstringnull要重做的任务UUID。如果未提供,则重做最近被撤销的任务
返回值:
{ success, taskId }

workflow_undone_list

workflow_undone_list

List all undone tasks that can be redone.
No parameters.
Returns:
{ success, count, undoneStack: [{ id, tag, description, time, changes }] }
列出所有可重做的已撤销任务。
无参数。
返回值:
{ success, count, undoneStack: [{ id, tag, description, time, changes }] }

workflow_revert_task

workflow_revert_task

(deprecated) Alias for
workflow_undo_task
. Use
workflow_undo_task
instead.
ParameterTypeRequiredDefaultDescription
taskIdstringYes-The UUID of the task to undo
Returns:
{ success, taskId }
(已废弃)
workflow_undo_task
的别名。请使用
workflow_undo_task
替代。
参数类型必填默认值描述
taskIdstring-要撤销的任务UUID
返回值:
{ success, taskId }

workflow_delete_task

workflow_delete_task

Delete a task from history (does not revert changes, just removes the record).
ParameterTypeRequiredDefaultDescription
taskIdstringYes-The UUID of the task to delete
Returns:
{ success, deletedId }
从历史中删除一个任务(不会恢复变更,仅移除记录)。
参数类型必填默认值描述
taskIdstring-要删除的任务UUID
返回值:
{ success, deletedId }

Minimal Example

极简示例

python
import unity_skills
python
import unity_skills

Session-level: wrap entire conversation for bulk undo

会话级:包裹整个对话以支持批量撤销

unity_skills.call_skill("workflow_session_start", tag="Build Player") unity_skills.call_skill("gameobject_create", name="Player", primitiveType="Capsule") unity_skills.call_skill("component_add", name="Player", componentType="Rigidbody") unity_skills.call_skill("workflow_session_end")
unity_skills.call_skill("workflow_session_start", tag="Build Player") unity_skills.call_skill("gameobject_create", name="Player", primitiveType="Capsule") unity_skills.call_skill("component_add", name="Player", componentType="Rigidbody") unity_skills.call_skill("workflow_session_end")

Later: undo entire session

后续操作:撤销整个会话

sessions = unity_skills.call_skill("workflow_session_list") unity_skills.call_skill("workflow_session_undo", sessionId=sessions["sessions"][0]["sessionId"])
undefined
sessions = unity_skills.call_skill("workflow_session_list") unity_skills.call_skill("workflow_session_undo", sessionId=sessions["sessions"][0]["sessionId"])
undefined

Auto-Tracked Operations

自动追踪的操作

The following operations are automatically tracked for undo when a session/task is active:
  • gameobject_create
    /
    gameobject_create_batch
  • gameobject_duplicate
    /
    gameobject_duplicate_batch
  • component_add
    /
    component_add_batch
  • ui_create_*
    (canvas, button, text, image, etc.)
  • light_create
  • prefab_instantiate
    /
    prefab_instantiate_batch
  • material_create
    /
    material_duplicate
  • terrain_create
  • cinemachine_create_vcam
For modification operations, the system auto-snapshots target objects before changes when possible.
当会话/任务处于活跃状态时,以下操作会被自动追踪以支持撤销:
  • gameobject_create
    /
    gameobject_create_batch
  • gameobject_duplicate
    /
    gameobject_duplicate_batch
  • component_add
    /
    component_add_batch
  • ui_create_*
    (画布、按钮、文本、图片等)
  • light_create
  • prefab_instantiate
    /
    prefab_instantiate_batch
  • material_create
    /
    material_duplicate
  • terrain_create
  • cinemachine_create_vcam
对于修改操作,系统会尽可能在变更前自动为目标对象创建快照。

Exact Signatures

精确签名

Exact names, parameters, defaults, and returns are defined by
GET /skills/schema
or
unity_skills.get_skill_schema()
, not by this file.
精确的名称、参数、默认值和返回值由
GET /skills/schema
unity_skills.get_skill_schema()
定义,而非本文件。