unity-prefabs
Skill3 starsChanged 2 months agoMITView on GitHub
Authoring reference for Unity prefabs and prefab variants (.prefab YAML) — the MCP tool workflow and the hand-written YAML fallback (fileID anchors, m_Modifications overrides, .prefab.meta GUIDs). Load before creating, editing, or debugging any .prefab or prefab variant file, especially when the Unity Editor / MCP is unavailable and the YAML must be written by hand.
In this repository45 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/issue-clarification-questions.mdcCursor rule
- .cursor/rules/reset-font-assets.mdcCursor rule
- .cursor/rules/src-dotnet-build-release.mdcCursor rule
- .cursor/rules/unity-plugins-before-work.mdcCursor rule
- codex-issueSkill
- commitSkill
- complete-prdSkill
- dependency-docsSkill
- dotnet-buildSkill
- dotnet-testSkill
- generate-imageSkill
- implementSkill
- meeting-joinSkill
- meeting-scheduleSkill
- meeting-startSkill
- plan-reviewSkill
- planSkill
- prSkill
- specifySkill
- unity-e2e-runSkill
- unity-pluginsSkill
- add-terminal-commandSkill
- dependency-docsSkill
- dotnet-benchmarkSkill
- dotnet-buildSkill
- dotnet-testSkill
- end-game-score-calibrationSkill
- flag-assetsSkill
- github-issue-automationSkill
- image-generationSkill
- localizationSkill
- meeting-joinSkill
- meeting-scheduleSkill
- meeting-startSkill
- milestone-completeSkill
- province-config-generatorSkill
- unity-e2e-runSkill
- unity-pluginsSkill
- unity-scenesSkill
- update-branchSkill
- cursor-meeting-joinSkill
- cursor-meeting-startSkill
- unity-pluginsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 64
When Unity Editor is connected via UnityMCP, use MCP tools instead of hand-writing YAML:
- Very specific: line 77
Write the .prefab file with a %YAML 1.1 header and one block per object (root GameObject + Transform + components).
- Very specific: line 78
Create a matching .prefab.meta file with a unique GUID:
- Very specific: line 92
Write the .prefab file containing only a single PrefabInstance block (see Prefab Variant section above).
- Very specific: line 93
Create a matching .prefab.meta file with a unique GUID (same format as above).
≈ “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
Prefab and Prefab Variant Format
Prefabs are Unity YAML files (%YAML 1.1). They can be created and modified by hand following the rules below. FileIDs are large unique positive integers — pick random 9–18 digit values that don't collide with existing anchors in the file.
Regular Prefab
Contains all GameObjects and components serialized as top-level YAML documents. Each object has a unique &fileID anchor. The root GameObject has m_Father: {fileID: 0} on its Transform.
Key object types:
!u!1— GameObject!u!4— Transform!u!114— MonoBehaviour
MonoBehaviour blocks reference their script by GUID (from the .cs.meta file):
m_Script: {fileID: 11500000, guid: <script-guid>, type: 3}
m_EditorClassIdentifier: AssemblyName::ClassNameSerialized fields appear directly under the MonoBehaviour by their C# field name:
_variable: 0Prefab Variant
A prefab variant file contains a single !u!1001 PrefabInstance block instead of the full hierarchy. It stores only the delta from the base prefab:
--- !u!1001 &<fileID>
PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: <source-object-fileID>, guid: <base-prefab-guid>, type: 3}
propertyPath: _variable
value: 42
objectReference: {fileID: 0}
m_RemovedGameObjects:
- {fileID: <source-fileID>, guid: <base-prefab-guid>, type: 3}
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: <base-prefab-guid>, type: 3}target.fileIDrefers to the object's fileID inside the base prefabtarget.guidis the GUID from the base prefab's.metafilem_RemovedGameObjectslists GameObjects from the base that are stripped in this variant- To override a field: add an entry to
m_Modificationswith the correctpropertyPath
MCP Workflow (preferred)
When Unity Editor is connected via UnityMCP, use MCP tools instead of hand-writing YAML:
- Create prefab:
manage_asset(actioncreate) ormanage_gameobject+manage_prefabs(actioncreate_from_gameobject) - Instantiate prefab in scene:
manage_gameobject(actioncreate, paramprefab_path) - Edit prefab fields:
manage_components(actionset_property) targeting the prefab asset - Create prefab variant:
manage_prefabs(actioncreate_variant)
Fall back to the manual YAML workflow below only when MCP is unavailable.
Manual Workflow
Create a prefab
- Write the
.prefabfile with a%YAML 1.1header and one block per object (root GameObject + Transform + components). Refer to the Regular Prefab section above for the structure. - Create a matching
.prefab.metafile with a unique GUID:
fileFormatVersion: 2
guid: <new-guid>
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: The GUID must be a 32-character lowercase hex string, unique across the project.
Create a prefab variant
- Write the
.prefabfile containing only a singlePrefabInstanceblock (see Prefab Variant section above). - Create a matching
.prefab.metafile with a unique GUID (same format as above). - The
m_SourcePrefab.guidmust match the base prefab's GUID from its.metafile.
Edit a prefab
- To change a serialized field value: find the MonoBehaviour block for that component and edit the field value directly.
- To add a component: add a new block with a unique fileID and add its fileID to the owning
GameObject.m_Componentlist. - To modify a variant override: edit the
valuein the matchingm_Modificationsentry; do not changetarget.fileIDortarget.guid. - To add a new override to a variant: append a new entry to
m_Modificationsusing the target object's fileID from the base prefab and the base prefab's GUID.
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.

