Unity Asset Diff
How to Diff Unity Materials and ScriptableObject Assets
Unity materials and ScriptableObjects are often text-serialized, but useful review requires more than reading YAML lines. For materials, inspect shaders, keywords, textures, and saved properties. For ScriptableObjects, inspect field paths, values, lists, type information, and resolved asset or object references.
Identify the asset and comparison source
git diff origin/main...HEAD -- Assets/Materials/Rock.mat
git diff origin/main...HEAD -- Assets/Data/EnemyBalance.asset
Confirm that the file is a Unity-created text asset rather than a binary file that happens to use a similar extension. Include its meta file and referenced shaders, textures, scripts, prefabs, or data assets in the review scope.
What to review in a .mat file
- The shader GUID and whether the intended shader asset still exists.
- Enabled and disabled shader keywords.
- Saved texture references and their scale/offset values.
- Saved float, color, vector, and integer properties.
- Render queue, instancing, double-sided GI, and other material flags.
- Properties removed or renamed by a shader change.
A material may remain valid while silently dropping an obsolete property or pointing at a different texture. Resolve references instead of reviewing GUID strings in isolation.
What to review in a ScriptableObject .asset file
- The
m_Scriptreference and whether its script GUID resolves. - Serialized field names, values, enums, and nested data.
- Array or list additions, removals, and order changes.
- Managed-reference type information when
SerializeReferenceis used. - Cross-asset GUID references and local fileID references.
- Changes caused by field renames, type migrations, or Unity-version serialization.
Review materials and data assets semantically
MergeSight visual material and ScriptableObject diff supports primary .mat and .asset workflows. It can group material keywords and saved property paths, show ScriptableObject fields, and expose Unity references with GUID/fileID context across working-tree, branch, and commit comparisons.
Use filters to isolate modified properties, references, or a specific asset path when a broad reserialization creates noise.
Common high-risk changes
| Change | Why it matters | Validation |
|---|---|---|
| Shader GUID | Can switch the complete rendering model. | Open material and representative renderer. |
| Texture reference | Valid YAML can still point to the wrong asset. | Resolve GUID and inspect import settings. |
| Script GUID | A missing script invalidates ScriptableObject type behavior. | Load asset and check Console/import state. |
| List reorder | Order can be semantically significant even with the same elements. | Compare old/new order and consuming code. |
| Field removal | Can be intended migration or silent data loss. | Review script changes and migration path. |
Validation checklist
- The material or ScriptableObject imports in the project's Unity version.
- Shader and script references resolve without missing assets.
- Texture, prefab, scene, and data references point to intended targets.
- List order and nested serialized values match runtime expectations.
- No unrelated mass reserialization hides the reviewed change.
- Representative consumers render or behave correctly.
FAQ
Can Git diff Unity material files?
Yes, when materials are text-serialized. Git shows YAML lines, while a Unity-aware diff can organize shader, keyword, texture, and saved-property changes.
Can Git diff ScriptableObject assets?
Yes, for text-serialized .asset files. Review the script reference, serialized fields, lists, managed-reference types, and cross-asset references.
Why did a Unity material change after a merge?
The merge may have changed its shader, keywords, render flags, saved property paths, or texture references even if the YAML remained valid.
Does MergeSight support .mat and .asset files?
Yes. Primary support includes text-serialized .mat and .asset files, including material saved properties and ScriptableObject-style serialized data.
Summary
Materials need shader context
Review shader GUID, keywords, textures, saved values, and render flags together.
Data assets need type context
Review script identity, fields, nested values, list order, and references.
Validate consumers
Open representative renderers or systems, not just the source file.
A useful .mat or .asset diff resolves low-level serialization into the shader, type, property, and reference behavior the project actually uses.
Next step
If changed GUIDs are unclear, use the Unity references and meta files guide.