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 : Processor

Inherits: 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):

Mode Value
Standard Mode
URP Conversion

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 IsLocalPackage

  • Filters to .mat files — only enabled, non-folder items with .mat extension (case-insensitive)

Quick Lookup

Goal
How

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.

Parameter
Type
Description

material

Material

The upgraded material (modified in-place)

oldMaterial

Material

Copy of the original material (read-only reference)

Static Fields

Field
Type
Access
Description

upgraders

List<MaterialUpgrader>

private static readonly

Cached list of URP material upgraders from Unity internals

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated