parse_unity_file
Parse Unity text-serialized files to extract only Inspector-visible component data in compact YAML, resolving asset references and reducing token usage.
Instructions
Parse a Unity text-serialized prefab, scene, or asset file and extract Inspector-visible component data in YAML format.
WORKFLOW: For best results with asset name resolution, call init_unity_project first. If already initialized, the cache is loaded automatically.
Automatically resolves asset names from GUIDs by scanning the project's .meta files (or using the initialized cache). Outputs a clean, hierarchical structure showing the GameObject tree and all component data.
IMPORTANT: Fields not shown in output have their default values or are null references.
Transform: lPos (0,0,0), lRot (0,0,0,1), lScale (1,1,1) are omitted when default
Null references and unresolved GUIDs are omitted
enabled:true is omitted (only enabled:false is shown)
Features:
Resolves script, material, sprite, and other asset references to human-readable names
Filters out Unity internal fields (m_ObjectHideFlags, serializedVersion, etc.)
Renames fields to match Unity Inspector names (m_LocalPosition -> localPosition)
Supports configurable detail levels: minimal, standard, or compact
Prefab Variant Support:
Auto-detects prefab variants and nested prefab instances
Shows variant_of field with base prefab name
Groups all modifications under base prefab name
Merges Vector3 properties (x, y, z -> single vector)
Filters default values and null references
Adds # + markers for variant modifications
Compact mode optimizations (83% token reduction):
Short reference syntax (@Player instead of GameObject:Player)
Parentheses vector notation: (1, 2, 3) instead of {x:1, y:2, z:3}
Field abbreviations: lPos, lRot, lScale, trigger, order, mats
Inline simple components: {value: 42, active: true}
Omits null/Unknown references entirely
Omits enabled:true, default offsets, flipX/flipY:false
Removes redundant sortingLayerID (keeps sortingLayer)
Converts 0/1 to true/false for boolean fields
Converts bitmasks to layer arrays or 'all'
Simplifies Unity events to show method names
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | No | Optional configuration (uses "standard" preset if omitted) | |
| filePath | Yes | Absolute path to the .prefab, .unity, or .asset file |