unity-editor
Unity Editor Skills
Control the Unity Editor itself - enter play mode, manage selection, undo/redo, and execute menu items.
Guardrails
Mode: Semi-Auto (available by default)
DO NOT (common hallucinations):
editor_rundoes not exist → useeditor_playto enter play modeeditor_compile/editor_recompiledo not exist → usedebug_force_recompileeditor_savedoes not exist → useeditor_execute_menuwith menuPath"File/Save"editor_execute_menurequires exact menu path — typos cause silent failure
Routing:
- For compilation check → use
debugmodule'sdebug_check_compilation - For console errors → use
debugmodule'sdebug_get_errors - For scene save →
scene_save(scene module) oreditor_execute_menumenuPath="File/Save"
Skills Overview
| Skill | Description |
|---|---|
editor_play |
Enter play mode |
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_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) |
Skills
editor_play
Enter play mode.
editor_stop
Exit play mode.
editor_pause
Toggle pause state.
editor_select
Select a GameObject.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | No* | Object name |
instanceId |
int | No* | Instance ID |
path |
string | No* | Object path |
instanceId |
int | No* | Instance ID |
*One identifier required
editor_get_selection
Get currently selected objects.
Returns: {success, count, objects: [{name, instanceId}]}
editor_get_context
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 state
editor_undo
Undo the last action.
editor_redo
Redo the last undone action.
editor_get_state
Get current editor state.
Returns: {success, isPlaying, isPaused, isCompiling, platform}
editor_execute_menu
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 |
editor_get_tags
Get all available tags.
Returns: {success, tags: [string]}
editor_get_layers
Get all available layers.
Returns: {success, layers: [{index, name}]}
Pause On Error
Pause-on-error is provided by the console module, not the editor module.
Use console_set_pause_on_error from console/SKILL.md.
Example Usage
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")
# 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")
Best Practices
- Check editor state before play mode operations
- Don't modify scene during play mode (changes lost)
- Use undo for safe experimentation
- Use
editor_get_contextto get instanceId for batch operations - Menu commands must match exact paths
Exact Signatures
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
More from besty0728/unity-skills
unity-skills
Unity Editor automation via REST API — create scripts, analyze scenes, manage assets, control editor, and orchestrate workflows. Triggers: Unity, Unity Skills, in Unity, automate Unity, editor automation, create script, scene summary, build scene, 全自动模式, full auto, semi-auto, 半自动, Unity自动化, Unity编辑器, Unity技能, 操作Unity,在Unity中.
56unity-uitoolkit
UI Toolkit (UITK) for Unity — create/edit USS stylesheets and UXML layouts, configure UIDocument in scenes. Triggers: UI Toolkit, UITK, UXML, USS, UIDocument, PanelSettings, VisualElement, stylesheet, runtime UI, EditorWindow UI, 界面工具包, UI样式, 样式表, 可视化元素.
22unity-ui
Unity UI creation. Use when users want to create Canvas, Button, Text, Image, or other UI elements. Triggers: UI, canvas, button, text, image, panel, slider, toggle, UGUI, 界面, 按钮, 文本, 面板.
20unity-scriptableobject
ScriptableObject management. Use when users want to create, read, or modify ScriptableObject assets. Triggers: scriptableobject, SO, data asset, config, settings asset, 数据资产, 配置文件.
19unity-light
Unity lighting control. Use when users want to create or configure lights (Directional, Point, Spot, Area). Triggers: light, lighting, directional light, point light, spot light, shadows, intensity, 灯光, 光照, 阴影.
17unity-material
Unity material and shader properties. Use when users want to create materials, set colors, textures, emission, or shader properties. Triggers: material, shader, color, texture, emission, albedo, metallic, smoothness, 材质, 颜色, 纹理, 发光.
17