gamedev-unity/skills/unity-skills/skills/scene/SKILL.md
Manage Unity scenes — create, load (single/additive), save, unload, switch the active scene, and get scene info/hierarchy. Use when opening or saving scenes, loading additively, switching the active scene, or querying scene contents, even if the user just says "打开场景" or "切场景". 管理 Unity 场景(创建、加载、叠加加载、保存、卸载、切换活动场景、获取场景信息与层级);当用户要打开或保存场景、叠加加载、切换活动场景、或查询场景内容时使用。
npx skillsauth add bernatmv/ai-rules unity-sceneInstall 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.
Control Unity scenes - the containers that hold all your GameObjects.
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。scene_create / scene_load / scene_save(标 RiskLevel="high",因为切换/覆盖整个场景文件影响范围极大)。这些在 Approval/Auto 下返 MODE_FORBIDDEN,仅 Bypass 或 Allowlist 命中可调。DO NOT (common hallucinations):
scene_delete / scene_rename do not exist → delete scene files via asset_delete, rename via asset_movescene_list does not exist → use scene_get_loaded (loaded scenes) or asset_find with t:Scene (all scene assets)scene_find_objects is a simple name/tag/component filter; for regex/layer/path search use gameobject_find (SkillMode.FullAuto)Routing:
perception module's hierarchy_describeperception module's scene_summarizescene_screenshot (this module) captures the Game View final composited image (all cameras + UI; in Play mode this is the live runtime frame); camera_screenshot (camera module, SkillMode.FullAuto) renders a single Game Camera off-screen| 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 |
Create a new scene.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| scenePath | string | Yes | Path for new scene (e.g., "Assets/Scenes/MyScene.unity") |
Load a scene.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| scenePath | string | Yes | - | Scene asset path |
| additive | bool | No | false | Load additively (keep current scene) |
Save the current scene.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| scenePath | string | No | Save path (null = save current) |
Get current scene information.
No parameters.
Returns: {success, name, path, isDirty, rootObjectCount, rootObjects: [name]}
Get full scene hierarchy tree.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| maxDepth | int | No | 10 | Maximum hierarchy depth |
Returns: {success, hierarchy: [{name, instanceId, children: [...]}]}
Capture a screenshot of the Game View — the final composited frame of all cameras + UI. In Play mode this is the live runtime image, not the Scene/editor view. For a single Game Camera's render use camera_screenshot instead.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| filename | string | No | "screenshot.png" | Bare filename only (no path separators); saved under Assets/Screenshots/ |
| width | int | No | 1920 | Image width |
| height | int | No | 1080 | Image height |
Returns: {success, path, width, height, isPlaying, note}. isPlaying indicates whether the frame is a live runtime image (Play mode) or a static Edit-mode frame.
Async: ScreenCapture.CaptureScreenshot writes the PNG ~1 frame later. If reading path immediately fails, wait ~200ms and retry.
Get list of all currently loaded scenes.
No parameters.
Returns: {success, scenes: [{name, path, isActive, isDirty}]}
Unload a loaded scene (additive).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| sceneName | string | Yes | Scene name to unload |
Set the active scene (for multi-scene editing).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| sceneName | string | Yes | Scene name to set active |
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}]}
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)
scene_get_info to verify scene stateAssets/Screenshots/ (filename is a bare name; any path separators are stripped)Exact 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 文件或合并冲突。