gamedev-unity/skills/unity-skills/skills/gameobject/SKILL.md
Create and manipulate GameObjects — create, delete, move, rotate, scale, parent, find, rename, batch-edit. Use when building or restructuring a scene hierarchy, spawning or removing objects, or adjusting transforms, even if the user doesn't say "GameObject". 创建与操控 GameObject(增删、移动、旋转、缩放、父子、查找、重命名、批量编辑);当用户要搭建或调整场景层级、新建或删除物体、修改 Transform 时使用。
npx skillsauth add bernatmv/ai-rules unity-gameobjectInstall 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.
BATCH-FIRST: Use
*_batchskills when operating on 2+ objects to reduce API calls from N to 1.
SkillMode.FullAuto,调用需用户 grant;grant 后服务端一步执行并返结果。gameobject_delete / gameobject_delete_batch(标记 Operation.Delete)。这些在 Approval/Auto 下返 MODE_FORBIDDEN,仅 Bypass 或用户 Allowlist 命中可调。DO NOT (common hallucinations):
gameobject_move / gameobject_rotate / gameobject_set_scale do not exist → use gameobject_set_transform (handles position, rotation, and scale together)gameobject_set_position does not exist → use gameobject_set_transform with posX/posY/posZgameobject_add_component does not exist → use component_add (component module)gameobject_get_transform does not exist → use gameobject_get_info (returns position/rotation/scale)Routing:
component modulematerial modulegameobject_find (this module) or scene_find_objects (scene module, SkillMode.SemiAuto)Object Targeting: All single-object skills accept
entityId(string, Unity 6000.4+ preferred — returned by all object skills),name(string),instanceId(int, Unity < 6000.4 preferred), andpath(string, hierarchy path like "Parent/Child"). Provide at least one. Priority:entityId > instanceId > path > name. On Unity 6000.4+ useentityId—instanceIdis reported as0. When onlynameis shown in a parameter table,entityId,instanceId, andpathare also accepted.
| Single Object | Batch Version | Use Batch When |
|---------------|---------------|----------------|
| gameobject_create | gameobject_create_batch | Creating 2+ objects |
| gameobject_delete | gameobject_delete_batch | Deleting 2+ objects |
| gameobject_duplicate | gameobject_duplicate_batch | Duplicating 2+ objects |
| gameobject_rename | gameobject_rename_batch | Renaming 2+ objects |
| gameobject_set_transform | gameobject_set_transform_batch | Moving 2+ objects |
| gameobject_set_active | gameobject_set_active_batch | Toggling 2+ objects |
| gameobject_set_parent | gameobject_set_parent_batch | Parenting 2+ objects |
| - | gameobject_set_layer_batch | Setting layer on 2+ objects |
| - | gameobject_set_tag_batch | Setting tag on 2+ objects |
Query Skills (no batch needed):
gameobject_find - Find objects by name/tag/layer/componentgameobject_get_info - Get detailed object informationCreate a new GameObject (primitive or empty).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | Yes | - | Object name |
| primitiveType | string | No | null | Cube/Sphere/Capsule/Cylinder/Plane/Quad (null=Empty) |
| x, y, z | float | No | 0 | Local position (relative to parent if set) |
| parentEntityId | string | No | null | Parent entityId (Unity 6000.4+, preferred) |
| parentName | string | No | null | Parent object name |
| parentInstanceId | int | No | 0 | Parent instance ID |
| parentPath | string | No | null | Parent hierarchy path |
Returns: {success, name, entityId, instanceId, path, parent, position}
Delete a GameObject.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
*At least one identifier required
Duplicate a GameObject.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
Returns: {originalName, copyName, copyEntityId, copyInstanceId, copyPath}
Rename a GameObject.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Current object name |
| instanceId | int | No* | Instance ID |
| newName | string | Yes | New name |
Returns: {success, oldName, newName, entityId, instanceId}
Find GameObjects matching criteria.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| name | string | No | null | Name filter |
| tag | string | No | null | Tag filter |
| layer | string | No | null | Layer filter |
| component | string | No | null | Component type filter |
| useRegex | bool | No | false | Use regex for name |
| limit | int | No | 50 | Max results |
Returns: {count, objects: [{name, entityId, instanceId, path, tag, layer, position}]}
Get detailed GameObject information.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
Returns: {name, entityId, instanceId, path, tag, layer, active, position, rotation, scale, parent, parentPath, childCount, children: [{name, entityId, instanceId, path}], components}
Set position, rotation, and/or scale. Supports world / local / RectTransform spaces.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
| posX/posY/posZ | float | No | World position |
| rotX/rotY/rotZ | float | No | World rotation (euler) |
| scaleX/scaleY/scaleZ | float | No | Local scale |
| localPosX/localPosY/localPosZ | float | No | Local position (relative to parent; works for both 3D and UI) |
| anchoredPosX/anchoredPosY | float | No | RectTransform anchored position (UI only) |
| anchorMinX/anchorMinY | float | No | RectTransform anchor min (0-1, UI only) |
| anchorMaxX/anchorMaxY | float | No | RectTransform anchor max (0-1, UI only) |
| pivotX/pivotY | float | No | RectTransform pivot (0-1, UI only) |
| sizeDeltaX/sizeDeltaY | float | No | RectTransform size delta (UI only) |
| width/height | float | No | Convenience aliases for sizeDeltaX/sizeDeltaY (UI only) |
*At least one identifier required. RectTransform / anchored* / anchor* / pivot* / sizeDelta* / width / height only apply to UI elements; ignored on regular Transforms.
Set parent-child relationship.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| childEntityId | string | No* | Child entity ID (Unity 6000.4+, preferred) |
| childName | string | No* | Child object name |
| childInstanceId | int | No* | Child instance ID |
| childPath | string | No* | Child hierarchy path |
| parentEntityId | string | No* | Parent entity ID (Unity 6000.4+, preferred) |
| parentName | string | No* | Parent object name (empty string = unparent) |
| parentInstanceId | int | No* | Parent instance ID |
| parentPath | string | No* | Parent hierarchy path |
*At least one child identifier required; omit all parent identifiers to unparent
Returns: {success, child, childEntityId, parent, parentEntityId, newPath}
Enable or disable a GameObject.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
| active | bool | Yes | Enable state |
*At least one identifier required
Returns: {success, name, entityId, active}
Set a GameObject's sibling index — its position among its parent's children, or among the scene's root objects when unparented. index is clamped into the valid range (clamped: true reports it).
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| entityId | string | No* | Entity ID (Unity 6000.4+, preferred) |
| name | string | No* | Object name |
| instanceId | int | No* | Instance ID |
| path | string | No* | Hierarchy path |
| index | int | Yes | Target sibling index (0 = first) |
*At least one identifier required
Returns: {success, name, entityId, path, parent, previousIndex, index, clamped}
Create multiple GameObjects in one call.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Item properties: name, primitiveType, x, y, z, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, parentEntityId, parentName, parentInstanceId, parentPath
Returns: {success, totalItems, successCount, failCount, results: [{success, name, instanceId, path, position}]}
unity_skills.call_skill("gameobject_create_batch", items=[
{"name": "Parent", "primitiveType": "Empty"},
{"name": "Child1", "primitiveType": "Cube", "x": 0, "parentName": "Parent"},
{"name": "Child2", "primitiveType": "Sphere", "x": 2, "parentName": "Parent"}
])
Delete multiple GameObjects.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name}]}
# By names
unity_skills.call_skill("gameobject_delete_batch", items=["Cube1", "Cube2", "Cube3"])
# By instanceId (preferred for precision)
unity_skills.call_skill("gameobject_delete_batch", items=[
{"instanceId": 12345},
{"instanceId": 12346}
])
# By path
unity_skills.call_skill("gameobject_delete_batch", items=[
{"path": "Environment/Cube1"},
{"path": "Environment/Cube2"}
])
Duplicate multiple GameObjects.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, originalName, copyName, copyInstanceId, copyPath}]}
unity_skills.call_skill("gameobject_duplicate_batch", items=[
{"instanceId": 12345},
{"instanceId": 12346}
])
Rename multiple GameObjects.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, oldName, newName, instanceId}]}
unity_skills.call_skill("gameobject_rename_batch", items=[
{"instanceId": 12345, "newName": "Enemy_01"},
{"instanceId": 12346, "newName": "Enemy_02"}
])
Set transforms for multiple objects.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Item properties (each item supports identifier + any subset of transform fields):
entityId / name / instanceId / path (at least one required)posX, posY, posZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZlocalPosX, localPosY, localPosZanchoredPosX, anchoredPosY, anchorMinX, anchorMinY, anchorMaxX, anchorMaxY, pivotX, pivotY, sizeDeltaX, sizeDeltaY, width, heightReturns: {success, totalItems, successCount, failCount, results: [{success, name, position, rotation, scale}]}
unity_skills.call_skill("gameobject_set_transform_batch", items=[
{"name": "Cube1", "posX": 0, "posY": 1},
{"instanceId": 12345, "posX": 2, "posY": 1},
{"path": "Env/Cube3", "posX": 4, "posY": 1}
])
Toggle multiple objects. Each item supports identifier (entityId / name / instanceId / path) + active (bool).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name, active}]}
unity_skills.call_skill("gameobject_set_active_batch", items=[
{"name": "Enemy1", "active": False},
{"name": "Enemy2", "active": False}
])
Parent multiple objects. Each item supports childEntityId/childName/childInstanceId/childPath and parentEntityId/parentName/parentInstanceId/parentPath.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, child, parent}]}
unity_skills.call_skill("gameobject_set_parent_batch", items=[
{"childName": "Wheel1", "parentName": "Car"},
{"childInstanceId": 12345, "parentName": "Car"},
{"childPath": "Wheels/Wheel3", "parentPath": "Vehicles/Car"}
])
Set layer for multiple objects. Each item supports identifier (entityId / name / instanceId / path) + layer (string layer name) + optional recursive (bool, default false — propagates layer to children).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name, layer}]}
unity_skills.call_skill("gameobject_set_layer_batch", items=[
{"name": "Enemy1", "layer": "Water"},
{"name": "Enemy2", "layer": "Water"}
])
Set tag for multiple objects. Each item supports identifier (entityId / name / instanceId / path) + tag (string tag name).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| items | json string | Yes | - | JSON array of per-item objects (see example below) |
Returns: {success, totalItems, successCount, failCount, results: [{success, name, tag}]}
unity_skills.call_skill("gameobject_set_tag_batch", items=[
{"name": "Enemy1", "tag": "Enemy"},
{"name": "Enemy2", "tag": "Enemy"}
])
import unity_skills
# GOOD: 3 API calls instead of 6
unity_skills.call_skill("gameobject_create_batch", items=[
{"name": "Floor", "primitiveType": "Plane"},
{"name": "Wall1", "primitiveType": "Cube"},
{"name": "Wall2", "primitiveType": "Cube"}
])
unity_skills.call_skill("gameobject_set_transform_batch", items=[
{"name": "Wall1", "posX": -5, "scaleY": 3},
{"name": "Wall2", "posX": 5, "scaleY": 3}
])
unity_skills.call_skill("gameobject_set_tag_batch", items=[
{"name": "Wall1", "tag": "Wall"},
{"name": "Wall2", "tag": "Wall"}
])
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 文件或合并冲突。