unity-camera
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBefore 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) first. If you already have the parameter definitions from recommend/schema, you may proceed straight to dryRun.GET /skills/recommend?includeSchema=true
调用本模块中的任何技能之前:如果你打算根据技能名称或描述猜测参数来调用技能,请停止——先阅读本文档(或通过获取其schema)。如果你已经从推荐/schema中获取了参数定义,可以直接进行dryRun。GET /skills/recommend?includeSchema=true
Triggers
触发场景
- Framing the Scene View
- Creating or adjusting cameras
- Tweaking FOV or clipping planes
- 取景 Scene View、创建或调整相机、修改 FOV 或裁剪面
- 调整Scene View取景
- 创建或调整相机
- 修改FOV或裁剪面
- 取景Scene View、创建或调整相机、修改FOV或裁剪面
Camera Skills
相机技能
Control the Scene View camera and Game Cameras (creation, transform, properties, screenshot, culling, orthographic toggle).
控制Scene View相机和Game Camera(创建、变换、属性、截图、剔除、正交模式切换)。
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) need user grant; grant triggers a single server-side execution that returns the result.camera_look_at - Auto / Bypass: those skills execute directly.
- Query skills (,
camera_get_info,camera_get_properties) arecamera_list— they run in all three modes without grant.SkillMode.SemiAuto - This module contains no Delete / PlayMode / Reload / high-risk skills (no NeverInSemi).
- 审批模式(默认):变更类技能(,
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 - 自动/绕过模式:这些技能直接执行。
- 查询类技能(,
camera_get_info,camera_get_properties)为camera_list——它们在三种模式下都无需授权即可运行。SkillMode.SemiAuto - 本模块不包含删除/播放模式/重载/高风险技能(无NeverInSemi类型)。
Guardrails
注意事项
DO NOT (common hallucinations):
- /
camera_movedo not exist → usecamera_rotate(Scene View) orcamera_set_transform(Game Camera)gameobject_set_transform - does not exist → use
camera_set_fovwithcamera_set_propertiesparameterfieldOfView - skills control two different cameras:
camera_*/camera_set_transform/camera_look_atcontrol the Scene View camera;camera_align_view_to_object/camera_create/camera_set_propertiescontrol Game Camerascamera_screenshot - does not exist → use
camera_deleteon the camera GameObjectgameobject_delete
Routing:
- For Cinemachine virtual cameras → use module
cinemachine - For Game Camera component properties → /
camera_set_properties(this module)camera_get_properties - For screenshots → three options: (scene module) = the Game View final composite (all cameras + UI; Play mode = live runtime frame);
scene_screenshot(this module) = a single Game Camera off-screen render;camera_screenshot(this module) = the editor Scene View (developer viewport, incl. grid/gizmos)camera_sceneview_screenshot
请勿(常见误区):
- /
camera_move不存在 → 使用camera_rotate(Scene View相机)或camera_set_transform(Game Camera)gameobject_set_transform - 不存在 → 使用
camera_set_fov并传入camera_set_properties参数fieldOfView - 技能控制两种不同的相机:
camera_*/camera_set_transform/camera_look_at控制Scene View相机;camera_align_view_to_object/camera_create/camera_set_properties控制Game Cameracamera_screenshot - 不存在 → 对相机GameObject使用
camera_deletegameobject_delete
路由规则:
- 对于Cinemachine虚拟相机 → 使用模块
cinemachine - 对于Game Camera组件属性 → /
camera_set_properties(本模块)camera_get_properties - 对于截图 → 三种选项:(scene模块)= Game View最终合成画面(所有相机+UI;播放模式=实时运行帧);
scene_screenshot(本模块)= 单个Game Camera的离屏渲染画面;camera_screenshot(本模块)= 编辑器Scene View画面(开发者视口,包含网格/gizmos)camera_sceneview_screenshot
Skills
技能列表
camera_align_view_to_object
camera_align_view_to_objectcamera_align_view_to_object
camera_align_view_to_objectAlign Scene View camera to look at an object.
Parameters:
- (string, optional): Target GameObject name.
name - (int, optional): Target GameObject instance ID.
instanceId - (string, optional): Target GameObject hierarchy path.
path
将Scene View相机对齐以看向目标物体。
参数:
- (字符串,可选):目标GameObject名称。
name - (整数,可选):目标GameObject实例ID。
instanceId - (字符串,可选):目标GameObject层级路径。
path
camera_get_info
camera_get_infocamera_get_info
camera_get_infoGet 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 (or to find one); if you just created a camera with and want to confirm its transform, will not show it.
Parameters: None.
camera_get_propertiescamera_listcamera_createcamera_get_info获取编辑器Scene View视口相机的位置和旋转信息——即开发者的视口,并非场景中的Camera组件。正因如此,它不需要目标参数。如需获取Game Camera的状态,请使用(或通过查找);如果你刚用创建了一个相机并想确认其变换信息,无法显示该内容。
参数:无。
camera_get_propertiescamera_listcamera_createcamera_get_infocamera_set_transform
camera_set_transformcamera_set_transform
camera_set_transformSet Scene View camera position/rotation manually.
Parameters:
- ,
posX,posY(float): Position.posZ - ,
rotX,rotY(float): Rotation (Euler).rotZ - (float, optional): Orthographic size or pivot distance (default 5).
size - (bool, optional): Move instantly (default true).
instant
手动设置Scene View相机的位置/旋转。
参数:
- ,
posX,posY(浮点数):位置坐标。posZ - ,
rotX,rotY(浮点数):旋转角度(欧拉角)。rotZ - (浮点数,可选):正交大小或枢轴距离(默认值为5)。
size - (布尔值,可选):是否立即移动(默认值为true)。
instant
camera_look_at
camera_look_atcamera_look_at
camera_look_atFocus Scene View camera on a world-space point.
Parameters:
- ,
x,y(float): Target point.z - Does not support or GameObject lookup. For object focus, use
targetName.camera_align_view_to_object
将Scene View相机聚焦到世界空间中的某个点。
参数:
- ,
x,y(浮点数):目标点坐标。z - 不支持或GameObject查找。如需聚焦物体,请使用
targetName。camera_align_view_to_object
camera_create
camera_createcamera_create
camera_createCreate 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 |
Returns:
{ success, name, instanceId }创建一个新的Game Camera。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| name | string | 否 | "New Camera" | 新相机GameObject的名称 |
| x | float | 否 | 0 | X轴位置 |
| y | float | 否 | 1 | Y轴位置 |
| z | float | 否 | -10 | Z轴位置 |
| addAudioListener | bool | 否 | false | 是否同时附加 |
返回值:
{ success, name, instanceId }camera_get_properties
camera_get_propertiescamera_get_properties
camera_get_propertiesGet 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 }获取Game Camera的属性(支持按名称/实例ID/路径查找)。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| name | string | 否 | null | 相机GameObject的名称 |
| instanceId | int | 否 | 0 | 相机GameObject的实例ID |
| path | string | 否 | null | 相机GameObject的层级路径 |
返回值:
{ success, name, fieldOfView, nearClipPlane, farClipPlane, orthographic, orthographicSize, depth, cullingMask, clearFlags, backgroundColor, rect }camera_set_properties
camera_set_propertiescamera_set_properties
camera_set_propertiesSet 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: |
| 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 channel you omit keeps the camera's current value, so you can set alpha alone.
bg*Returns: — the response echoes the camera's state after the write, and lists which parameters were actually changed, named exactly as you passed them (the background channels appear individually as , , , , not lumped under ), so a parameter absent from was not supplied. That echo is your verification: a second call is redundant. An unparseable rejects the whole call with + before anything is applied, so the numeric parameters in the same call are never half-written.
{ success, name, applied, fieldOfView, nearClipPlane, farClipPlane, orthographic, orthographicSize, depth, cullingMask, clearFlags, backgroundColor, rect }appliedbgRbgGbgBbgAbackgroundColorappliedcamera_get_propertiesclearFlagsSEMANTIC_INVALIDvalidValues设置Game Camera的属性(FOV、裁剪面、清除标志、背景颜色、深度)。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| name | string | 否 | null | 相机GameObject的名称 |
| instanceId | int | 否 | 0 | 相机GameObject的实例ID |
| path | string | 否 | null | 相机GameObject的层级路径 |
| fieldOfView | float? | 否 | null | 相机视野 |
| nearClipPlane | float? | 否 | null | 近裁剪面距离 |
| farClipPlane | float? | 否 | null | 远裁剪面距离 |
| depth | float? | 否 | null | 相机渲染深度 |
| clearFlags | string | 否 | null | 清除标志: |
| bgR | float? | 否 | null | 背景颜色红色分量(0-1) |
| bgG | float? | 否 | null | 背景颜色绿色分量(0-1) |
| bgB | float? | 否 | null | 背景颜色蓝色分量(0-1) |
| bgA | float? | 否 | null | 背景颜色透明度(0-1) |
任何你省略的通道将保留相机当前的值,因此你可以单独设置透明度。
bg*返回值:——响应会返回写入之后的相机状态,列表会显示实际被修改的参数,名称与你传入的完全一致(背景通道会单独显示为, , , ,而非归在下),因此未出现在中的参数即为未提供的参数。该返回值可作为验证依据:无需再次调用。如果无法解析,整个调用会被拒绝并返回 + ,且不会应用任何参数,因此同一调用中的数值参数不会被半写入。
{ success, name, applied, fieldOfView, nearClipPlane, farClipPlane, orthographic, orthographicSize, depth, cullingMask, clearFlags, backgroundColor, rect }appliedbgRbgGbgBbgAbackgroundColorappliedcamera_get_propertiesclearFlagsSEMANTIC_INVALIDvalidValuescamera_set_culling_mask
camera_set_culling_maskcamera_set_culling_mask
camera_set_culling_maskSet 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 }按层名称(逗号分隔)设置Game Camera的剔除遮罩。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| layerNames | string | 是 | - | 逗号分隔的层名称 |
| name | string | 否 | null | 相机GameObject的名称 |
| instanceId | int | 否 | 0 | 相机GameObject的实例ID |
| path | string | 否 | null | 相机GameObject的层级路径 |
返回值:
{ success, cullingMask }camera_screenshot
camera_screenshotcamera_screenshot
camera_screenshotCapture 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 ( |
| maxDimension | int | No | 1280 | Only used when |
Returns: , plus when . If the base64 payload would exceed 8MB, the skill returns an error asking for a smaller — the file at is still saved.
{ success, path, width, height }{ imageBase64, imageWidth, imageHeight, imageBytes }returnImage=truemaxDimensionpath捕获Game Camera的画面并保存到文件。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| savePath | string | 否 | "Assets/screenshot.png" | 截图保存路径 |
| width | int | 否 | 1920 | 截图宽度(像素) |
| height | int | 否 | 1080 | 截图高度(像素) |
| name | string | 否 | null | 相机GameObject的名称 |
| instanceId | int | 否 | 0 | 相机GameObject的实例ID |
| path | string | 否 | null | 相机GameObject的层级路径 |
| returnImage | bool | 否 | false | 是否同时在响应中返回PNG格式的base64编码图片( |
| maxDimension | int | 否 | 1280 | 仅当 |
返回值:,当时额外返回。如果base64负载超过8MB,技能会返回错误并要求设置更小的——但中的文件仍会被保存。
{ success, path, width, height }returnImage=true{ imageBase64, imageWidth, imageHeight, imageBytes }maxDimensionpathcamera_sceneview_screenshot
camera_sceneview_screenshotcamera_sceneview_screenshot
camera_sceneview_screenshotCapture the editor Scene View (the developer's editing viewport — can overlook the whole scene incl. off-camera objects). Distinct from (Game View / player camera) and (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.
scene_screenshotcamera_screenshot| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| filename | string | No | "sceneview.png" | Bare filename only (no path separators); saved under |
| 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 ( |
| maxDimension | int | No | 1280 | Only used when |
Returns: — is or — plus when . If the base64 payload would exceed 8MB, the skill returns an error asking for a smaller — the file at is still saved.
{ success, path, width, height, mode, note }mode"screen_with_overlays""offscreen_clean"{ imageBase64, imageWidth, imageHeight, imageBytes }returnImage=truemaxDimensionpathreturnImage usage tip: a local agent that can read files (e.g. Claude Code against a local Unity Editor) should generally omit and just read the PNG at — it's cheaper on tokens. Use for remote/MCP clients that have no filesystem access to the Unity project.
returnImagepathreturnImage=true捕获编辑器Scene View画面(即开发者的编辑视口——可俯瞰整个场景,包括相机视野外的物体)。与(Game View/玩家相机)和(单个Game Camera)不同。默认捕获完整的Scene View画面,包括网格/gizmos/选择框(屏幕读取);如果编辑器版本缺少内部API,会自动回退到纯净的离屏渲染。进行叠加捕获时,Scene View窗口必须处于打开且可见状态。
scene_screenshotcamera_screenshot| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| filename | string | 否 | "sceneview.png" | 仅文件名(无路径分隔符);保存到 |
| includeOverlays | bool | 否 | true | true = 包含网格/gizmos/选择框的完整Scene View画面(如果不支持则回退到纯净渲染);false = 仅纯净的离屏场景渲染画面 |
| returnImage | bool | 否 | false | 是否同时在响应中返回PNG格式的base64编码图片( |
| maxDimension | int | 否 | 1280 | 仅当 |
返回值:——为或——当时额外返回。如果base64负载超过8MB,技能会返回错误并要求设置更小的——但中的文件仍会被保存。
{ success, path, width, height, mode, note }mode"screen_with_overlays""offscreen_clean"returnImage=true{ imageBase64, imageWidth, imageHeight, imageBytes }maxDimensionpathreturnImage使用提示:可以读取文件的本地代理(例如连接本地Unity Editor的Claude Code)通常应省略,直接读取下的PNG文件——这样更节省token。对于无法访问Unity项目文件系统的远程/MCP客户端,请使用。
returnImagepathreturnImage=truecamera_set_orthographic
camera_set_orthographiccamera_set_orthographic
camera_set_orthographicSwitch 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 }切换Game Camera的正交/透视模式。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| orthographic | bool | 是 | - | true为正交模式,false为透视模式 |
| orthographicSize | float? | 否 | null | 正交大小(仅在正交模式下生效) |
| name | string | 否 | null | 相机GameObject的名称 |
| instanceId | int | 否 | 0 | 相机GameObject的实例ID |
| path | string | 否 | null | 相机GameObject的层级路径 |
返回值:
{ success, orthographic, orthographicSize }camera_list
camera_listcamera_list
camera_listList all cameras in the scene.
| Parameter | Type | Required | Default | Description |
|---|
Returns:
{ count, cameras: [{ name, instanceId, path, depth, orthographic, enabled }] }列出场景中的所有相机。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|
返回值:
{ count, cameras: [{ name, instanceId, path, depth, orthographic, enabled }] }Exact Signatures
精确签名
Exact names, parameters, defaults, and returns are defined by or , not by this file.
GET /skills/schemaunity_skills.get_skill_schema()精确的名称、参数、默认值和返回值由或定义,而非本文档。
GET /skills/schemaunity_skills.get_skill_schema()