gamedev-unity/skills/unity-skills/skills/editor/SKILL.md
Control and observe the Unity Editor — read persistent scene/file changes, enter/exit/pause play mode, select objects, undo/redo, and execute menu items. Use after the user edited Unity while the AI was away, when file watching reports changes, or when driving Editor state. 控制并观察 Unity 编辑器(读取持久化场景/文件变更、进入/退出/暂停 play mode、选中对象、撤销/重做、执行菜单项);当用户在 AI 离开期间修改了 Unity、文件监控发现变化、或需要操控编辑器状态时使用。
npx skillsauth add bernatmv/ai-rules unity-editorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Observe and control the Unity Editor without parsing scene YAML.
editor_get_changes / editor_get_selection / editor_get_context / editor_get_state / editor_get_tags / editor_get_layers 标 SkillMode.SemiAuto,可直接执行;其余 editor_select / editor_undo / editor_redo / editor_execute_menu 默认 FullAuto,Approval 模式下需 grant。editor_play / editor_play_capture / editor_stop / editor_pause(标 MayEnterPlayMode = true)。这些在 Approval/Auto 下返 MODE_FORBIDDEN,仅 Bypass 或 Allowlist 命中可调。DO NOT (common hallucinations):
editor_run does not exist → use editor_play to enter play modeeditor_compile / editor_recompile do not exist → use debug_force_recompileeditor_save does not exist → use editor_execute_menu with menuPath "File/Save"editor_execute_menu requires exact menu path — typos cause silent failureRouting:
debug module's debug_check_compilationdebug module's debug_get_errorsscene_save (scene module) or editor_execute_menu menuPath="File/Save"editor_get_changes before reading .unity YAMLeditor_get_changes.dropped=true → its 500-entry retention window was exceeded; rebuild context with scene_context / scene_diff| Skill | Description |
|-------|-------------|
| editor_play | Enter play mode |
| editor_play_capture | Observe runtime errors, optionally screenshot, then exit |
| editor_stop | Exit play mode |
| editor_pause | Toggle pause |
| editor_select | Select GameObject |
| editor_get_selection | Get selected objects |
| editor_get_context | Get full editor context (selection, assets, scene) |
| editor_get_changes | Read persistent scene/file changes by cursor |
| editor_undo | Undo last action |
| editor_redo | Redo last action |
| editor_get_state | Get editor state |
| editor_execute_menu | Execute menu item |
| editor_get_tags | Get all tags |
| editor_get_layers | Get all layers |
| console_set_pause_on_error | Pause play mode on error (console module) |
Enter play mode. Warning: any unsaved scene changes made during Play mode will be lost when exiting.
Returns: {success, mode, jobId} — mode="playing", jobId returned from AsyncJobService so callers can poll entering_play_mode completion.
Enter Play Mode, observe errors for durationSeconds (default 10, range 1–300), optionally capture the Game View, then exit. Returns a Job whose result includes healthy, error aggregates, stoppedEarly, and screenshotPath.
Exit play mode.
Returns: {success, mode} — mode="stopped".
Toggle pause state.
Returns: {success, paused} — paused is the new boolean state.
Select a GameObject.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID (preferred) |
| path | string | No* | Object path |
*One identifier required
Get currently selected objects.
Returns: {count, objects: [{name, instanceId}]}
Get full editor context including selection, assets, and scene info.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| includeComponents | bool | No | false | Include component list |
| includeChildren | bool | No | false | Include children info |
Returns:
selectedGameObjects: Objects in Hierarchy (instanceId, path, tag, layer)selectedAssets: Assets in Project window (GUID, path, type, isFolder)activeScene: Current scene info (name, path, isDirty)focusedWindow: Name of focused editor windowisPlaying, isCompiling: Editor stateRead the persistent change journal at Library/UnitySkills/editor_changes.jsonl. It captures scene object/component/property summaries plus imported, deleted, and moved asset paths across Domain Reloads. It never parses or returns raw .unity YAML.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| since | long | No | 0 | Previous response cursor; 0 reads retained history |
| types | string | No | all | Comma-separated scene, file, undo, or lifecycle |
| source | string | No | all | editor/manual, rest, or all |
| limit | int | No | 100 | Newest entries to return, 1-500 |
Returns: {hasChanges, cursor, oldestSeq, dropped, truncated, changes}. Save cursor for the next call. dropped=true means older changes fell outside the 500-entry journal, so rebuild full scene context.
Undo the last action.
Redo the last undone action.
Get current editor state.
Returns: {isPlaying, isPaused, isCompiling, timeSinceStartup, unityVersion, platform}
Execute a menu command.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| menuPath | string | Yes | Menu item path |
Common Menu Paths:
| Menu Path | Action |
|-----------|--------|
| File/Save | Save current scene |
| File/Build Settings... | Open build settings |
| Edit/Play | Toggle play mode |
| GameObject/Create Empty | Create empty object |
| Window/General/Console | Open console |
| Assets/Refresh | Refresh assets |
Get all available tags.
Returns: {tags: [string]}
Get all available layers.
Returns: {layers: [{index, name}]}
Pause-on-error is provided by the console module, not the editor module.
Use console_set_pause_on_error from console/SKILL.md.
import unity_skills
# Check editor state before operations
state = unity_skills.call_skill("editor_get_state")
if state['isCompiling']:
print("Wait for compilation to finish")
# On resume or after file-watch notification, inspect semantic changes first.
changes = unity_skills.call_skill("editor_get_changes", since=last_cursor)
last_cursor = changes["cursor"]
# Get full context (useful for understanding current state)
context = unity_skills.call_skill("editor_get_context", includeComponents=True)
for obj in context['selectedGameObjects']:
print(f"Selected: {obj['name']} (ID: {obj['instanceId']})")
# Select and operate on object
unity_skills.call_skill("editor_select", name="Player")
selection = unity_skills.call_skill("editor_get_selection")
# Safe experimentation with undo
unity_skills.call_skill("gameobject_delete", name="TestObject")
unity_skills.call_skill("editor_undo") # Restore if needed
# Execute menu command
unity_skills.call_skill("editor_execute_menu", menuPath="File/Save")
editor_get_changes before reading scene fileseditor_get_context to get instanceId for batch operationsExact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
development
Keyword research and validation with real search-demand data — never ship keywords from intuition alone. Probes Google Autocomplete per language (free, no account) to prove demand and discover the exact phrasing people type, checks SERPs for winnability, and uses Keyword Planner/Ahrefs/Semrush exports when the user has access. Activates when: choosing or reviewing SEO keywords, meta keywords, page titles, article topics or slugs, landing page copy targeting search, App Store/ASO keyword fields, multilingual keyword sets, 'what should we rank for', 'keyword analysis', or auditing why a page doesn't rank. Also invoke it as a validation pass whenever another skill or task produces a keyword list.
development
Automate YooAsset hot-update and asset bundles — build bundles, run Editor simulate builds, manage Collector groups, analyze BuildReport, and validate runtime. Use when building or simulating YooAsset bundles, configuring collectors, or validating hot-update assets, even if the user just says "热更" or "打AB包". 自动化 YooAsset 热更新与资源包(构建 bundle、编辑器模拟构建、管理 Collector 分组、分析 BuildReport、运行时校验);当用户要构建或模拟 YooAsset 资源包、配置 collector、或校验热更资源时使用。
development
Source-anchored design rules for YooAsset v2.3.18 — initialization, default-package shortcuts, play modes, asset handles, loading, updates, filesystem, build, and pitfalls. Use when writing or reviewing YooAsset code, initializing packages, loading assets via handles, setting up hot-update/download, or choosing a play mode, even if the user just says "热更" or "资源包". 为 YooAsset v2.3.18 提供源码锚定的设计规则(初始化、默认包快捷方式、运行模式、资源句柄、加载、更新、文件系统、构建、陷阱);当用户要编写或审查 YooAsset 代码、初始化 package、用句柄加载资源、配置热更/下载、或选择运行模式时使用。
data-ai
Last-resort guidance for safely hand-editing Unity serialized YAML (.unity/.prefab/.asset/.meta/ProjectSettings) — reference/fileID repair, GUID safety, and merge-conflict fixes. Use when REST cannot reach the change and YAML must be hand-edited — fixing m_Script GUIDs, broken fileID references, .meta files, or merge conflicts, even if the user just says "场景文件打不开" or "引用丢了". 安全手编 Unity 序列化 YAML(.unity/.prefab/.asset/.meta/ProjectSettings)的最后手段(引用/fileID 修复、GUID 安全、合并冲突修复);当 REST 无法触达、必须手编 YAML 时使用——修复 m_Script GUID、断裂 fileID 引用、.meta 文件或合并冲突。