unity-prefab
Skill7 starsChanged 7 months agoMITView on GitHub
Use when users want to create, instantiate, apply, or unpack prefabs.
In this repository34 other files it gives its agents.
- unity-mcp-skillsSkill
- unity-animatorSkill
- unity-assetSkill
- unity-cameraSkill
- unity-cinemachineSkill
- unity-cleanerSkill
- unity-componentSkill
- unity-consoleSkill
- unity-editorSkill
- unity-eventSkill
- unity-gameobjectSkill
- unity-importerSkill
- unity-lightSkill
- unity-materialSkill
- unity-navmeshSkill
- unity-optimizationSkill
- unity-packageSkill
- unity-perceptionSkill
- unity-physicsSkill
- unity-probuilderSkill
- unity-projectSkill
- unity-sceneSkill
- unity-scriptableobjectSkill
- unity-scriptSkill
- unity-shaderSkill
- unity-smartSkill
- unity-terrainSkill
- unity-testSkill
- unity-timelineSkill
- unity-toolingSkill
- unity-uiSkill
- unity-uitoolkitSkill
- unity-validationSkill
- unity-xrSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Create a prefab from a scene GameObject.
- Distinctive: line 136
Create a prefab variant from an existing prefab.
- Distinctive: line 176
Use prefabs for repeated objects
- Distinctive: line 179
Use batch instantiation for level generation
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unity Prefab Skills
Overview
BATCH-FIRST: Use
prefab_instantiate_batchwhen spawning 2+ prefab instances.
Common Mistakes
DO NOT (common hallucinations):
prefab_create_from_objectdoes not exist → useprefab_create(takes scene object name/instanceId and savePath)prefab_spawndoes not exist → useprefab_instantiateprefab_edit/prefab_modifydo not exist → useprefab_set_property(edit prefab asset directly) or instantiate, modify, thenprefab_applyprefab_savedoes not exist → useprefab_apply(applies instance changes to source prefab)
Routing:
- To modify components on a prefab instance in scene → use
componentmodule skills, thenprefab_apply - To set a property directly on the prefab asset →
prefab_set_property(this module) - To find all instances of a prefab →
prefab_find_instances(this module)
Skills Overview
| Single Object | Batch Version | Use Batch When |
prefab_instantiate | prefab_instantiate_batch | Spawning 2+ instances |
No batch needed:
prefab_create- Create prefab from scene objectprefab_apply- Apply instance changes to prefabprefab_unpack- Unpack prefab instanceprefab_get_overrides- Get instance overridesprefab_revert_overrides- Revert to prefab valuesprefab_apply_overrides- Apply overrides to prefabprefab_create_variant- Create a prefab variantprefab_find_instances- Find all instances of a prefab in sceneprefab_set_property- Set a property on a component inside a Prefab asset (supports basic types, vectors, colors, and asset references)
Skills
prefab_create
Create a prefab from a scene GameObject.
| Parameter | Type | Required | Description |
name | string | No* | Source object name |
instanceId | int | No* | Instance ID |
path | string | No* | Object path |
savePath | string | Yes | Prefab save path |
Returns: {success, prefabPath, sourceObject}
prefab_instantiate
Instantiate a prefab into the scene.
| Parameter | Type | Required | Default | Description |
prefabPath | string | Yes | - | Prefab asset path |
name | string | No | prefab name | Instance name |
x, y, z | float | No | 0 | Local position (relative to parent if set) |
parentName | string | No | null | Parent object name |
parentInstanceId | int | No | 0 | Parent instance ID |
parentPath | string | No | null | Parent hierarchy path |
Returns: {success, name, instanceId, path, prefabPath, position}
prefab_instantiate_batch
Instantiate multiple prefabs in one call.
| Parameter | Type | Required | Description |
items | array | Yes | Array of instantiation configs |
Item properties: prefabPath, name, x, y, z, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, parentName, parentInstanceId, parentPath
Returns: {success, totalItems, successCount, failCount, results: [{success, name, instanceId, prefabPath, position}]}
Recipe path rule: ../../recipes/prefab/<command>.md
prefab_apply
Apply instance changes back to the prefab asset.
| Parameter | Type | Required | Description |
name | string | No* | Prefab instance name |
instanceId | int | No* | Instance ID |
path | string | No* | Object path |
Returns: {success, gameObject, prefabPath}
prefab_unpack
Unpack a prefab instance (break prefab connection).
| Parameter | Type | Required | Default | Description |
name | string | No* | - | Prefab instance name |
instanceId | int | No* | - | Instance ID |
path | string | No* | - | Object path |
completely | bool | No | false | Unpack all nested prefabs |
Returns: {success, gameObject, mode}
prefab_get_overrides
Get list of property overrides on a prefab instance.
| Parameter | Type | Required | Description |
name | string | No* | Prefab instance name |
instanceId | int | No* | Instance ID |
Returns: {success, overrides: [{type, path, property}]}
prefab_revert_overrides
Revert all overrides on a prefab instance back to prefab values.
| Parameter | Type | Required | Description |
name | string | No* | Prefab instance name |
instanceId | int | No* | Instance ID |
prefab_apply_overrides
Apply all overrides from instance to source prefab asset.
| Parameter | Type | Required | Description |
name | string | No* | Prefab instance name |
instanceId | int | No* | Instance ID |
prefab_create_variant
Create a prefab variant from an existing prefab.
| Parameter | Type | Required | Default | Description |
sourcePrefabPath | string | Yes | - | Path to the source prefab asset |
variantPath | string | Yes | - | Save path for the new variant |
Returns: { success, sourcePath, variantPath, name }
prefab_find_instances
Find all instances of a prefab in the current scene.
| Parameter | Type | Required | Default | Description |
prefabPath | string | Yes | - | Prefab asset path to search for |
limit | int | No | 50 | Maximum number of instances to return |
Returns: { success, prefabPath, count, instances: [{ name, path, instanceId }] }
prefab_set_property
Set a property on a component inside a Prefab asset file (without instantiating it). Supports basic types, vectors, colors, enums, and asset references.
| Parameter | Type | Required | Default | Description |
prefabPath | string | Yes | - | Path to the prefab asset |
componentType | string | Yes | - | Component type name |
propertyName | string | Yes | - | Serialized property name |
value | string | Cond. | null | Value for basic types (int/float/bool/string/enum/vector/color) |
assetReferencePath | string | Cond. | null | Asset path for Object reference fields (Material, Texture, AudioClip, ScriptableObject, etc.) |
gameObjectName | string | No | null | Child object name inside prefab (defaults to root) |
Provide either
value(basic types) orassetReferencePath(asset references).
Returns: { success, prefabPath, gameObject, component, property, valueSet }
Best Practices
- Organize prefabs in dedicated folders
- Use prefabs for repeated objects
- Apply changes to update all instances
- Unpack only when unique modifications needed
- Use batch instantiation for level generation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

