Agent SkillsBesty0728/Unity-Skills › unity-camera

unity-camera

GitHub

用于控制 Unity 编辑器场景视图和游戏中相机的技能模块,支持创建、调整位置、属性、截图及裁剪面等操作。

SkillsForUnity/unity-skills~/skills/camera/SKILL.md Besty0728/Unity-Skills

Trigger Scenarios

取景 Scene View 创建或调整相机 修改 FOV 或裁剪面

Install

npx skills add Besty0728/Unity-Skills --skill unity-camera -g -y
More Options

Non-standard path

npx skills add https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/camera -g -y

Use without installing

npx skills use Besty0728/Unity-Skills@unity-camera

指定 Agent (Claude Code)

npx skills add Besty0728/Unity-Skills --skill unity-camera -a claude-code -g -y

安装 repo 全部 skill

npx skills add Besty0728/Unity-Skills --all -g -y

预览 repo 内 skill

npx skills add Besty0728/Unity-Skills --list

SKILL.md

Frontmatter
{
    "name": "unity-camera",
    "description": "Control Unity Scene View and Game cameras"
}

Before calling any skill in this module: if you are about to call a skill with parameters guessed from its name or description, STOP — read this file (or fetch its schema via GET /skills/recommend?includeSchema=true) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.

Triggers

  • Framing the Scene View
  • Creating or adjusting cameras
  • Tweaking FOV or clipping planes
  • 取景 Scene View、创建或调整相机、修改 FOV 或裁剪面

Camera Skills

Control the Scene View camera and Game Cameras (creation, transform, properties, screenshot, culling, orthographic toggle).

Operating Mode

  • Approval (default): mutating skills (camera_set_transform, camera_create, camera_set_properties, camera_set_culling_mask, camera_screenshot, camera_sceneview_screenshot, camera_set_orthographic, camera_align_view_to_object, camera_look_at) need user grant; grant triggers a single server-side execution that returns the result.
  • Auto / Bypass: those skills execute directly.
  • Query skills (camera_get_info, camera_get_properties, camera_list) are SkillMode.SemiAuto — they run in all three modes without grant.
  • This module contains no Delete / PlayMode / Reload / high-risk skills (no NeverInSemi).

Guardrails

DO NOT (common hallucinations):

  • camera_move / camera_rotate do not exist → use camera_set_transform (Scene View) or gameobject_set_transform (Game Camera)
  • camera_set_fov does not exist → use camera_set_properties with fieldOfView parameter
  • camera_* skills control two different cameras: camera_set_transform/camera_look_at/camera_align_view_to_object control the Scene View camera; camera_create/camera_set_properties/camera_screenshot control Game Cameras
  • camera_delete does not exist → use gameobject_delete on the camera GameObject

Routing:

  • For Cinemachine virtual cameras → use cinemachine module
  • For Game Camera component properties → camera_set_properties / camera_get_properties (this module)
  • For screenshots → three options: scene_screenshot (scene module) = the Game View final composite (all cameras + UI; Play mode = live runtime frame); camera_screenshot (this module) = a single Game Camera off-screen render; camera_sceneview_screenshot (this module) = the editor Scene View (developer viewport, incl. grid/gizmos)

Skills

camera_align_view_to_object

Align Scene View camera to look at an object. Parameters:

  • name (string, optional): Target GameObject name.
  • instanceId (int, optional): Target GameObject instance ID.
  • path (string, optional): Target GameObject hierarchy path.

camera_get_info

Get the editor Scene View viewport camera's position and rotation — the developer's viewport, not a Camera component in the scene. It takes no target parameters for exactly that reason. For a Game Camera's state use camera_get_properties (or camera_list to find one); if you just created a camera with camera_create and want to confirm its transform, camera_get_info will not show it. Parameters: None.

camera_set_transform

Set Scene View camera position/rotation manually. Parameters:

  • posX, posY, posZ (float): Position.
  • rotX, rotY, rotZ (float): Rotation (Euler).
  • size (float, optional): Orthographic size or pivot distance (default 5).
  • instant (bool, optional): Move instantly (default true).

camera_look_at

Focus Scene View camera on a world-space point. Parameters:

  • x, y, z (float): Target point.
  • Does not support targetName or GameObject lookup. For object focus, use camera_align_view_to_object.

camera_create

Create a new Game Camera.

Parameter Type Required Default Description
name string No "New Camera" Name of the new camera GameObject
x float No 0 Position X
y float No 1 Position Y
z float No -10 Position Z
addAudioListener bool No false Also attach an AudioListener component

Returns: { success, name, instanceId }

camera_get_properties

Get Game Camera properties (supports name/instanceId/path).

Parameter Type Required Default Description
name string No null Name of the camera GameObject
instanceId int No 0 Instance ID of the camera GameObject
path string No null Hierarchy path of the camera GameObject

Returns: { success, name, fieldOfView, nearClipPlane, farClipPlane, orthographic, orthographicSize, depth, cullingMask, clearFlags, backgroundColor, rect }

camera_set_properties

Set Game Camera properties (FOV, clip planes, clear flags, background color, depth).

Parameter Type Required Default Description
name string No null Name of the camera GameObject
instanceId int No 0 Instance ID of the camera GameObject
path string No null Hierarchy path of the camera GameObject
fieldOfView float? No null Camera field of view
nearClipPlane float? No null Near clipping plane distance
farClipPlane float? No null Far clipping plane distance
depth float? No null Camera rendering depth
clearFlags string No null Clear flags: Skybox, Color, SolidColor, Depth, Nothing. Color and SolidColor are two names for the same underlying CameraClearFlags value, so both are accepted and the response always echoes it back as Color — do not read that as the write having been ignored
bgR float? No null Background color red component (0-1)
bgG float? No null Background color green component (0-1)
bgB float? No null Background color blue component (0-1)
bgA float? No null Background color alpha (0-1)

Any bg* channel you omit keeps the camera's current value, so you can set alpha alone.

Returns: { success, name, applied, fieldOfView, nearClipPlane, farClipPlane, orthographic, orthographicSize, depth, cullingMask, clearFlags, backgroundColor, rect } — the response echoes the camera's state after the write, and applied lists which parameters were actually changed, named exactly as you passed them (the background channels appear individually as bgR, bgG, bgB, bgA, not lumped under backgroundColor), so a parameter absent from applied was not supplied. That echo is your verification: a second camera_get_properties call is redundant. An unparseable clearFlags rejects the whole call with SEMANTIC_INVALID + validValues before anything is applied, so the numeric parameters in the same call are never half-written.

camera_set_culling_mask

Set Game Camera culling mask by layer names (comma-separated).

Parameter Type Required Default Description
layerNames string Yes - Comma-separated layer names
name string No null Name of the camera GameObject
instanceId int No 0 Instance ID of the camera GameObject
path string No null Hierarchy path of the camera GameObject

Returns: { success, cullingMask }

camera_screenshot

Capture a screenshot from a Game Camera to file.

Parameter Type Required Default Description
savePath string No "Assets/screenshot.png" File path to save the screenshot
width int No 1920 Screenshot width in pixels
height int No 1080 Screenshot height in pixels
name string No null Name of the camera GameObject
instanceId int No 0 Instance ID of the camera GameObject
path string No null Hierarchy path of the camera GameObject
returnImage bool No false Also return the PNG as base64 in the response (imageBase64), for clients without filesystem access
maxDimension int No 1280 Only used when returnImage=true; downscales the returned image (not the saved file) so its longer edge is ≤ this value. Clamped to 256–4096

Returns: { success, path, width, height }, plus { imageBase64, imageWidth, imageHeight, imageBytes } when returnImage=true. If the base64 payload would exceed 8MB, the skill returns an error asking for a smaller maxDimension — the file at path is still saved.

camera_sceneview_screenshot

Capture the editor Scene View (the developer's editing viewport — can overlook the whole scene incl. off-camera objects). Distinct from scene_screenshot (Game View / player camera) and camera_screenshot (one Game Camera). By default captures the full Scene View incl. grid/gizmos/selection (on-screen read); auto-falls back to a clean offscreen render if the editor build lacks the internal API. The Scene View window must be open and visible for the overlay capture.

Parameter Type Required Default Description
filename string No "sceneview.png" Bare filename only (no path separators); saved under Assets/Screenshots/
includeOverlays bool No true True = full Scene View with grid/gizmos/selection (falls back to a clean render if unsupported); false = clean offscreen scene render only
returnImage bool No false Also return the PNG as base64 in the response (imageBase64), for clients without filesystem access
maxDimension int No 1280 Only used when returnImage=true; downscales the returned image (not the saved file) so its longer edge is ≤ this value. Clamped to 256–4096

Returns: { success, path, width, height, mode, note }mode is "screen_with_overlays" or "offscreen_clean" — plus { imageBase64, imageWidth, imageHeight, imageBytes } when returnImage=true. If the base64 payload would exceed 8MB, the skill returns an error asking for a smaller maxDimension — the file at path is still saved.

returnImage usage tip: a local agent that can read files (e.g. Claude Code against a local Unity Editor) should generally omit returnImage and just read the PNG at path — it's cheaper on tokens. Use returnImage=true for remote/MCP clients that have no filesystem access to the Unity project.

camera_set_orthographic

Switch Game Camera between orthographic and perspective mode.

Parameter Type Required Default Description
orthographic bool Yes - True for orthographic, false for perspective
orthographicSize float? No null Orthographic size (only applies in orthographic mode)
name string No null Name of the camera GameObject
instanceId int No 0 Instance ID of the camera GameObject
path string No null Hierarchy path of the camera GameObject

Returns: { success, orthographic, orthographicSize }

camera_list

List all cameras in the scene.

Parameter Type Required Default Description

Returns: { count, cameras: [{ name, instanceId, path, depth, orthographic, enabled }] }


Exact Signatures

Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.

Version History

  • 8c31c5a Current 2026-08-27 12:42

    修复模块文档审计问题,更新地址资源文档,规范无参技能描述及协议引用,优化技能模块结构。

  • 5ee8388 2026-08-17 04:10

    精简根SKILL.md体积至6.2KB,将协议细节移至参考文档;新增SKILL_GUIDE.md指导模式;更新版本锚点至2.6.0并添加CHANGELOG条目。

  • 25d511e 2026-08-13 09:13

    压缩 SKILL.md description 至约 5,191 字符,并将路由说明移至 Triggers 部分。

  • e49379b 2026-07-31 06:53

    版本升级至2.4.0

  • ec9f870 2026-07-05 14:39

Same Skill Collection

SkillsForUnity/unity-skills~/skills/addressables-design/SKILL.md
SkillsForUnity/unity-skills~/skills/addressables/SKILL.md
SkillsForUnity/unity-skills~/skills/adr/SKILL.md
SkillsForUnity/unity-skills~/skills/animator/SKILL.md
SkillsForUnity/unity-skills~/skills/behavior/SKILL.md
SkillsForUnity/unity-skills~/skills/blueprints/SKILL.md
SkillsForUnity/unity-skills~/skills/event/SKILL.md
SkillsForUnity/unity-skills~/skills/graphics/SKILL.md
SkillsForUnity/unity-skills~/skills/history/SKILL.md
SkillsForUnity/unity-skills~/skills/manual-component/SKILL.md
SkillsForUnity/unity-skills~/skills/manual-gameobject/SKILL.md
SkillsForUnity/unity-skills~/skills/manual-material/SKILL.md
SkillsForUnity/unity-skills~/skills/manual-scene/SKILL.md
SkillsForUnity/unity-skills~/skills/material/SKILL.md
SkillsForUnity/unity-skills~/skills/netcode-design/SKILL.md
SkillsForUnity/unity-skills~/skills/netcode/SKILL.md
SkillsForUnity/unity-skills~/skills/perception/SKILL.md
SkillsForUnity/unity-skills~/skills/pico-design/SKILL.md
SkillsForUnity/unity-skills~/skills/primetween/SKILL.md
SkillsForUnity/unity-skills~/skills/probuilder/SKILL.md
SkillsForUnity/unity-skills~/skills/profiler/SKILL.md
SkillsForUnity/unity-skills~/skills/project-scout/SKILL.md
SkillsForUnity/unity-skills~/skills/sample/SKILL.md
SkillsForUnity/unity-skills~/skills/shadergraph-design/SKILL.md
SkillsForUnity/unity-skills~/skills/SKILL.md
SkillsForUnity/unity-skills~/skills/smart/SKILL.md
SkillsForUnity/unity-skills~/skills/unity-cli/SKILL.md
SkillsForUnity/unity-skills~/skills/yaml-editing/SKILL.md
SkillsForUnity/unity-skills~/SKILL.md
SkillsForUnity/unity-skills~/skills/architecture/SKILL.md
SkillsForUnity/unity-skills~/skills/asmdef/SKILL.md
SkillsForUnity/unity-skills~/skills/asset/SKILL.md
SkillsForUnity/unity-skills~/skills/async/SKILL.md
SkillsForUnity/unity-skills~/skills/batch/SKILL.md
SkillsForUnity/unity-skills~/skills/bookmark/SKILL.md
SkillsForUnity/unity-skills~/skills/cinemachine/SKILL.md
SkillsForUnity/unity-skills~/skills/cleaner/SKILL.md
SkillsForUnity/unity-skills~/skills/component/SKILL.md
SkillsForUnity/unity-skills~/skills/console/SKILL.md
SkillsForUnity/unity-skills~/skills/debug/SKILL.md
SkillsForUnity/unity-skills~/skills/decal/SKILL.md
SkillsForUnity/unity-skills~/skills/dotween-design/SKILL.md
SkillsForUnity/unity-skills~/skills/dotween/SKILL.md
SkillsForUnity/unity-skills~/skills/editor/SKILL.md
SkillsForUnity/unity-skills~/skills/gameobject/SKILL.md
SkillsForUnity/unity-skills~/skills/hybridclr/SKILL.md
SkillsForUnity/unity-skills~/skills/importer/SKILL.md
SkillsForUnity/unity-skills~/skills/inspector/SKILL.md
SkillsForUnity/unity-skills~/skills/light/SKILL.md

Metadata

Files
0
Version
61f72e2
Hash
84fe6ed6
Indexed
2026-07-05 14:39

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 04:30
浙ICP备14020137号-1 $Carte des visiteurs$