MaterialProcessor
Post-processor that upgrades imported materials from Unity's Standard shader to the Universal Render Pipeline (URP) Lit shader. Handles transparency and blend mode conversion for legacy rendering modes.
Definition
Namespace: Paragon.Editor.ThirdPartyPackageImporter Assembly: Paragon.Editor.dll
internal class MaterialProcessor : ProcessorInherits: Processor
Remarks
Third-party packages from the Unity Asset Store often use the Standard shader. This processor automatically upgrades them to URP/Lit using Unity's built-in MaterialUpgrader system, plus custom handling for transparency modes that the standard upgrader doesn't cover.
URP Upgraders
The static constructor uses reflection to access UniversalRenderPipelineMaterialUpgrader.GetUpgraders() (a non-public method) to get the full list of URP material upgraders. These are cached for all future upgrades.
Extended Upgrade: Transparency Modes
After the standard URP upgrade, ExtendedUpgrade checks the original material's _Mode property (Standard shader rendering mode):
0
Opaque
No extra work (handled by standard upgrader)
1
Cutout
_Surface=1, _AlphaClip=1, render queue 2450
2
Fade/Transparent
_Surface=1, _AlphaClip=1, _AlphaCutoff=0, SrcAlpha blending, render queue 3000
Item Filtering
Skips local packages — returns empty for
IsLocalPackageFilters to
.matfiles — only enabled, non-folder items with.matextension (case-insensitive)
Quick Lookup
Upgrade runs automatically
Part of the PostProcessors pipeline
Target shader
Universal Render Pipeline/Lit
Source shader
Unity Standard (mode-based transparency)
Methods
OnProcess (protected override)
Returns enabled .mat items from the package. Returns empty for local packages.
OnProcessItem (protected override)
Loads the material, creates a copy of the original state, runs the URP upgrade, applies extended transparency handling, and marks dirty.
ExtendedUpgrade (private static)
Handles transparency mode conversion that the standard MaterialUpgrader doesn't cover. Only applies when the upgraded shader is Universal Render Pipeline/Lit.
material
Material
The upgraded material (modified in-place)
oldMaterial
Material
Copy of the original material (read-only reference)
Static Fields
upgraders
List<MaterialUpgrader>
private static readonly
Cached list of URP material upgraders from Unity internals
Common Pitfalls
Reflection dependency on URP internals The static constructor accesses UniversalRenderPipelineMaterialUpgrader.GetUpgraders() via reflection. This internal method may change or be removed in future URP versions.
Material name overwrite OnProcessItem sets material.name to the file name (without extension). This overwrites any existing material name, which may differ from the file name if the material was renamed after creation.
Only handles Standard shader modes 0-2 The ExtendedUpgrade only handles _Mode values 0 (Opaque), 1 (Cutout), and 2 (Fade). Mode 3 (Transparent) is not explicitly handled and will use whatever the standard upgrader produces.
See Also
PostProcessors Overview — post-processor subsystem
FBXProcessor — renames materials in FBX files
MetaProcessor — strips asset metadata
Last updated