unity-scene
Unity scene management. Use when users want to create, load (single or additive), save, unload, switch active scene, get scene info or hierarchy, capture screenshot, or search objects in scene. Triggers: scene, new scene, create scene, load scene, save scene, additive scene, unload scene, multi-scene, active scene, scene hierarchy, hierarchy tree, screenshot, game view screenshot, scene find objects, 场景, 新建场景, 创建场景, 加载场景, 保存场景, 加性加载, 卸载场景, 多场景, 活动场景, 场景层级, 层级树, 截图, 截屏, 场景查找对象.
- License 许可
- MIT
- 最近更新
- 2026-07-25
- Stars
- ★ 8
- Forks
- 0
01 前言 Front Matter
- name
- unity-scene
- metadata
- { "tier": 2, "source": "https://github.com/Besty0728/Unity-Skills", "version": "1.9.2" }
- use-when
- Load when the task requires: Unity scene management. Use when users want to create, load (single or additive), save, unload, switch active scene, get scene info or hierarchy, capture screenshot, or search objects in scene. Unity Editor must be running with the unity-skills REST server reachable at http://localhost:8090.
- platforms
- [ "unity-editor", "claude-code" ]
- description
- Unity scene management. Use when users want to create, load (single or additive), save, unload, switch active scene, get scene info or hierarchy, capture screenshot, or search objects in scene. Triggers: scene, new scene, create scene, load scene, save scene, additive scene, unload scene, multi-scene, active scene, scene hierarchy, hierarchy tree, screenshot, game view screenshot, scene find objects, 场景, 新建场景, 创建场景, 加载场景, 保存场景, 加性加载, 卸载场景, 多场景, 活动场景, 场景层级, 层级树, 截图, 截屏, 场景查找对象.
- do-not-use-when
- Do not load when Unity Editor is not running locally. Do not load when unity-skills REST server is unreachable at http://localhost:8090. For detailed hierarchy tree → use `perception` module instead. For scene statistics → use `perception` module instead.
- task-categories
- [ "scene", "editor-automation" ]
03 SKILL.md 正文
Unity Scene Skills
Control Unity scenes - the containers that hold all your GameObjects.
Operating Mode
- Approval(默认):本模块 Mixed ——
scene_get_info/scene_get_hierarchy/scene_get_loaded/scene_find_objects标SkillMode.SemiAuto,可直接执行;scene_screenshot/scene_unload/scene_set_active未设 Mode 字段(默认 FullAuto),Approval 模式下需 grant。 - Auto / Bypass:FullAuto 直接执行。
- 含 NeverInSemi 高危 skill:
scene_create/scene_load/scene_save(标RiskLevel="high",因为切换/覆盖整个场景文件影响范围极大)。这些在 Approval/Auto 下返MODE_FORBIDDEN,仅 Bypass 或 Allowlist 命中可调。
DO NOT (common hallucinations):
scene_delete/scene_renamedo not exist → delete scene files viaasset_delete, rename viaasset_movescene_listdoes not exist → usescene_get_loaded(loaded scenes) orasset_findwitht:Scene(all scene assets)scene_find_objectsis a simple name/tag/component filter; for regex/layer/path search usegameobject_find(SkillMode.FullAuto)
Routing:
- For detailed hierarchy tree → use
perceptionmodule'shierarchy_describe - For scene statistics → use
perceptionmodule'sscene_summarize - For screenshot →
scene_screenshot(this module) orcamera_screenshot(camera module, SkillMode.FullAuto)
Skills Overview
| Skill | Description |
|---|---|
scene_create |
Create a new scene |
scene_load |
Load a scene |
scene_save |
Save current scene |
scene_get_info |
Get scene information |
scene_get_hierarchy |
Get hierarchy tree |
scene_screenshot |
Capture screenshot |
scene_get_loaded |
Get all loaded scenes |
scene_unload |
Unload an additive scene |
scene_set_active |
Set active scene |
scene_find_objects |
Search objects by name/tag/component |
Skills
scene_create
Create a new scene.
| Parameter | Type | Required | Description |
|---|---|---|---|
scenePath |
string | Yes | Path for new scene (e.g., "Assets/Scenes/MyScene.unity") |
scene_load
Load a scene.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
scenePath |
string | Yes | - | Scene asset path |
additive |
bool | No | false | Load additively (keep current scene) |
scene_save
Save the current scene.
| Parameter | Type | Required | Description |
|---|---|---|---|
scenePath |
string | No | Save path (null = save current) |
scene_get_info
Get current scene information.
No parameters.
Returns: {success, name, path, isDirty, rootObjectCount, rootObjects: [name]}
scene_get_hierarchy
Get full scene hierarchy tree.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
maxDepth |
int | No | 10 | Maximum hierarchy depth |
Returns: {success, hierarchy: [{name, instanceId, children: [...]}]}
scene_screenshot
Capture a screenshot.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
filename |
string | No | "screenshot.png" | Output filename |
width |
int | No | 1920 | Image width |
height |
int | No | 1080 | Image height |
scene_get_loaded
Get list of all currently loaded scenes.
No parameters.
Returns: {success, scenes: [{name, path, isActive, isDirty}]}
scene_unload
Unload a loaded scene (additive).
| Parameter | Type | Required | Description |
|---|---|---|---|
sceneName |
string | Yes | Scene name to unload |
scene_set_active
Set the active scene (for multi-scene editing).
| Parameter | Type | Required | Description |
|---|---|---|---|
sceneName |
string | Yes | Scene name to set active |
scene_find_objects
Search GameObjects by name pattern, tag, or component type. For advanced search (regex, layer, path) use gameobject_find.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
namePattern |
string | No | - | Name substring to match (case-insensitive) |
tag |
string | No | - | Filter by tag |
componentType |
string | No | - | Filter by component type name |
limit |
int | No | 50 | Max results to return |
Returns: {success, count, objects: [{name, path, instanceId, active, tag}]}
Example Usage
import unity_skills
# Create a new scene
unity_skills.call_skill("scene_create", scenePath="Assets/Scenes/Level1.unity")
# Load an existing scene
unity_skills.call_skill("scene_load", scenePath="Assets/Scenes/MainMenu.unity")
# Load scene additively (multi-scene)
unity_skills.call_skill("scene_load", scenePath="Assets/Scenes/UI.unity", additive=True)
# Get current scene info
info = unity_skills.call_skill("scene_get_info")
print(f"Scene: {info['name']}, Objects: {info['rootObjectCount']}")
# Get full hierarchy (useful for understanding scene structure)
hierarchy = unity_skills.call_skill("scene_get_hierarchy", maxDepth=5)
# Save scene
unity_skills.call_skill("scene_save")
# Take screenshot
unity_skills.call_skill("scene_screenshot", filename="preview.png", width=1920, height=1080)
Best Practices
- Always save before loading a new scene
- Use additive loading for UI overlays
- Keep scene hierarchy organized with empty parent objects
- Use
scene_get_infoto verify scene state - Screenshots are saved to project root by default
Exact Signatures
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
04 同仓库更多 Skills
dots-update-groups
How to choose the right ECS system group and ordering so per-frame and per-fixed-step work is deterministic and never races its own readers. Covers InitializationSystemGroup / SimulationSystemGroup / PresentationSystemGroup / FixedStepSimulationSystemGroup / VariableRateSimulationSystemGroup, UpdateBefore / UpdateAfter peer ordering, OrderFirst / OrderLast group-boundary placement, RateManager, and the cross-group ordering trap. Use when adding an ISystem, fixing "value visible one frame late" bugs, or coupling simulation to a fixed timestep.
dots-transform-patterns
The Entities 1.x transform model — LocalTransform (writable input) vs LocalToWorld (system-owned matrix), Parent/Child hierarchy, reparenting cost, uniform vs non-uniform scale (PostTransformMatrix), and when to opt out with custom transform systems. Use when designing parent/child hierarchies, runtime reparenting (mount/dismount/socket), or choosing transform components at the Baker boundary.
dots-singleton-patterns
Model cross-system shared configuration and game state as a single-entity component with a strict single-writer contract. Covers RequireForUpdate gating, SystemAPI.GetSingleton / GetSingletonRW / HasSingleton / TryGetSingleton, bake-time vs runtime-created vs ECB-system singletons, the "exactly one entity" runtime invariant, and the single-writer rule. Use when designing frame-stable global config, shared mutable state, or any component intended to exist on exactly one entity.
dots-hybrid-bridge
The one-way bridge between DOTS-owned runtime state and Unity-owned presentation. Covers UnityObjectRef for managed asset refs in components, the DOTS-writes / Unity-reads ownership rule, when to use managed IComponentData vs UnityObjectRef vs CompanionComponent, baker-bridge vs runtime-bridge, and SubScene boundary rules. Use when an entity must reference Unity assets (Mesh, Material, AudioClip, ScriptableObject), a MonoBehaviour view must read entity state, or input/UI must trigger ECS work.
dots-event-driven-ecs
Model one-frame events and external requests in ECS without dual ownership, polling, or persistent state leaks. Covers request-tag pattern with ECB, enableable command components (no structural change), event buffers (IBufferElementData), explicit consumer ownership, one-frame latency rules, and the banned C# event / UnityEvent / static bus anti-patterns. Use when input/UI/network must trigger ECS work, when a one-frame signal fans out to N consumers (damage, hit, collision), or when state changes must be processed exactly once.
valid_skill
A complete, well-formed test fixture skill for SkillHub validation testing. Covers basic task routing and code review for Unity projects.