AgentSkillsCN

unity-scene

管理Unity场景——创建、加载、保存并查询场景信息。

SKILL.md
--- frontmatter
name: unity-scene
description: "Manage Unity scenes - create, load, save, and query scene information."

Unity Scene Skills

Control Unity scenes - the containers that hold all your GameObjects.

Skills Overview

SkillDescription
scene_createCreate a new scene
scene_loadLoad a scene
scene_saveSave current scene
scene_get_infoGet scene information
scene_get_hierarchyGet hierarchy tree
scene_screenshotCapture screenshot

Skills

scene_create

Create a new scene.

ParameterTypeRequiredDescription
scenePathstringYesPath for new scene (e.g., "Assets/Scenes/MyScene.unity")

scene_load

Load a scene.

ParameterTypeRequiredDefaultDescription
scenePathstringYes-Scene asset path
additiveboolNofalseLoad additively (keep current scene)

scene_save

Save the current scene.

ParameterTypeRequiredDescription
scenePathstringNoSave 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.

ParameterTypeRequiredDefaultDescription
maxDepthintNo10Maximum hierarchy depth

Returns: {success, hierarchy: [{name, instanceId, children: [...]}]}

scene_screenshot

Capture a screenshot.

ParameterTypeRequiredDefaultDescription
filenamestringNo"screenshot.png"Output filename
widthintNo1920Image width
heightintNo1080Image height

Example Usage

python
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

  1. Always save before loading a new scene
  2. Use additive loading for UI overlays
  3. Keep scene hierarchy organized with empty parent objects
  4. Use scene_get_info to verify scene state
  5. Screenshots are saved to project root by default