unity-smart
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUnity Smart Skills
Unity智能技能
Guardrails
使用规范
Mode: Full-Auto required
DO NOT (common hallucinations):
- /
smart_createdo not exist → smart skills are query/layout tools, not creation toolssmart_build - does not exist → use
smart_searchfor SQL-like scene queriessmart_query - does not exist → use
smart_moveorsmart_snap_to_gridsmart_align_to_ground
Routing:
- For creating objects → use module
gameobject - For simple object search → use or
gameobject_findscene_find_objects - For complex scene queries (SQL-like) → (this module)
smart_query
模式:需设置为全自动
禁止操作(常见错误):
- /
smart_create不存在 → 智能技能是查询/布局工具,而非创建工具smart_build - 不存在 → 请使用
smart_search进行类SQL场景查询smart_query - 不存在 → 请使用
smart_move或smart_snap_to_gridsmart_align_to_ground
路由指引:
- 创建对象 → 使用模块
gameobject - 简单对象搜索 → 使用或
gameobject_findscene_find_objects - 复杂场景查询(类SQL) → (本模块)
smart_query
Skills
技能列表
smart_scene_query
smart_scene_query
Find objects based on component property values (SQL-like).
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Component type (Light, Camera, MeshRenderer) |
| string | Yes | - | Property to query (intensity, enabled, etc.) |
| string | No | "==" | ==, !=, >, <, >=, <=, contains |
| string | No | null | Value to compare |
| int | No | 50 | Max results |
| string | No | null | Unsupported shorthand; if provided alone returns a guidance error |
Example:
python
undefined根据组件属性值查找对象(类SQL)。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 是 | - | 组件类型(Light、Camera、MeshRenderer) |
| string | 是 | - | 要查询的属性(intensity、enabled等) |
| string | 否 | "==" | ==、!=、>、<、>=、<=、contains |
| string | 否 | null | 要比较的值 |
| int | 否 | 50 | 最大结果数 |
| string | 否 | null | 不支持的简写形式;若单独传入会返回指引错误 |
示例:
python
undefinedFind all lights with intensity > 2
查找所有强度大于2的灯光
call_skill("smart_scene_query", componentName="Light", propertyName="intensity", op=">", value="2")
---call_skill("smart_scene_query", componentName="Light", propertyName="intensity", op=">", value="2")
---smart_scene_layout
smart_scene_layout
Organize selected objects into a layout.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No | "Linear" | Linear, Grid, Circle, Arc |
| string | No | "X" | X, Y, Z, -X, -Y, -Z |
| float | No | 2.0 | Space between items (or radius) |
| int | No | 3 | For Grid layout |
| float | No | 180 | For Arc layout (degrees) |
| bool | No | false | Rotate to face center |
Example:
python
undefined将选中的对象整理为指定布局。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 否 | "Linear" | Linear(线性)、Grid(网格)、Circle(圆形)、Arc(弧形) |
| string | 否 | "X" | X、Y、Z、-X、-Y、-Z |
| float | 否 | 2.0 | 项目间距(或半径) |
| int | 否 | 3 | 适用于Grid布局 |
| float | 否 | 180 | 适用于Arc布局(度数) |
| bool | 否 | false | 旋转至朝向中心 |
示例:
python
undefinedArrange selected objects in a circle
将选中对象排列为圆形
call_skill("smart_scene_layout", layoutType="Circle", spacing=5)
---call_skill("smart_scene_layout", layoutType="Circle", spacing=5)
---smart_reference_bind
smart_reference_bind
Auto-fill a List/Array field with matching objects.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Target GameObject |
| string | Yes | - | Component on target |
| string | Yes | - | Field to fill |
| string | No | null | Find by tag |
| string | No | null | Find by name contains |
| bool | No | false | Append instead of replace |
Example:
python
undefined自动用匹配对象填充List/Array字段。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 是 | - | 目标GameObject |
| string | 是 | - | 目标对象上的组件 |
| string | 是 | - | 要填充的字段 |
| string | 否 | null | 按标签查找 |
| string | 否 | null | 按名称包含查找 |
| bool | 否 | false | 追加而非替换 |
示例:
python
undefinedFill GameManager.spawns with all SpawnPoint tagged objects
将所有带有SpawnPoint标签的对象填充到GameManager的spawns字段中
call_skill("smart_reference_bind", targetName="GameManager", componentName="GameController", fieldName="spawns", sourceTag="SpawnPoint")
---call_skill("smart_reference_bind", targetName="GameManager", componentName="GameController", fieldName="spawns", sourceTag="SpawnPoint")
---smart_scene_query_spatial
smart_scene_query_spatialsmart_scene_query_spatial
smart_scene_query_spatialFind objects within a sphere/box region, optionally filtered by component.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| float | Yes | - | Center X coordinate |
| float | Yes | - | Center Y coordinate |
| float | Yes | - | Center Z coordinate |
| float | No | 10 | Search sphere radius |
| string | No | null | Only include objects with this component |
| int | No | 50 | Max results |
Returns:
{ success, count, center, radius, results }查找球体/盒子区域内的对象,可按组件筛选。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| float | 是 | - | 中心X坐标 |
| float | 是 | - | 中心Y坐标 |
| float | 是 | - | 中心Z坐标 |
| float | 否 | 10 | 搜索球体半径 |
| string | 否 | null | 仅包含带有该组件的对象 |
| int | 否 | 50 | 最大结果数 |
返回值:
{ success, count, center, radius, results }smart_align_to_ground
smart_align_to_groundsmart_align_to_ground
smart_align_to_groundRaycast selected objects downward to align them to the ground. Requires objects selected in Hierarchy first.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| float | No | 100 | Maximum raycast distance |
| bool | No | false | Align rotation to surface normal |
Returns:
{ success, aligned, total }向下射线检测选中对象,使其对齐地面。需先在层级面板中选中对象。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| float | 否 | 100 | 最大射线检测距离 |
| bool | 否 | false | 对齐旋转至表面法线 |
返回值:
{ success, aligned, total }smart_distribute
smart_distributesmart_distribute
smart_distributeEvenly distribute selected objects between first and last positions. Requires at least 3 objects selected in Hierarchy first.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | No | "X" | X, Y, Z, -X, -Y, -Z |
Returns:
{ success, distributed, axis }在第一个和最后一个对象的位置之间均匀分布选中对象。需先在层级面板中选中至少3个对象。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 否 | "X" | X、Y、Z、-X、-Y、-Z |
返回值:
{ success, distributed, axis }smart_snap_to_grid
smart_snap_to_gridsmart_snap_to_grid
smart_snap_to_gridSnap selected objects to a grid.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| float | No | 1 | Grid cell size |
Returns:
{ success, snapped, gridSize }将选中对象对齐到网格。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| float | 否 | 1 | 网格单元格大小 |
返回值:
{ success, snapped, gridSize }smart_randomize_transform
smart_randomize_transformsmart_randomize_transform
smart_randomize_transformRandomize position/rotation/scale of selected objects within ranges.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| float | No | 0 | Position randomization range |
| float | No | 0 | Rotation randomization range (degrees) |
| float | No | 1 | Minimum uniform scale |
| float | No | 1 | Maximum uniform scale |
Returns:
{ success, randomized }在指定范围内随机化选中对象的位置/旋转/缩放。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| float | 否 | 0 | 位置随机化范围 |
| float | 否 | 0 | 旋转随机化范围(度数) |
| float | 否 | 1 | 最小统一缩放比例 |
| float | 否 | 1 | 最大统一缩放比例 |
返回值:
{ success, randomized }smart_replace_objects
smart_replace_objectssmart_replace_objects
smart_replace_objectsReplace selected objects with a prefab (preserving transforms). Requires objects selected in Hierarchy first.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Asset path to the replacement prefab |
Returns:
{ success, replaced, prefab }用预制体替换选中对象(保留变换属性)。需先在层级面板中选中对象。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 是 | - | 替换预制体的资源路径 |
返回值:
{ success, replaced, prefab }smart_select_by_component
smart_select_by_componentsmart_select_by_component
smart_select_by_componentSelect all objects that have a specific component.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Component type name to search for |
Returns:
{ success, selected, component }选中所有带有指定组件的对象。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| string | 是 | - | 要搜索的组件类型名称 |
返回值:
{ success, selected, component }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()