feat: Add MirrorRenderPipelineConverter for URP Compatibility #3994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces
MirrorRenderPipelineConverter
, an editor script that automatically converts materials in theAssets/Mirror/Examples
folder from Unity’s built-in render pipeline (e.g.,Standard
,Legacy Shaders
) to the Universal Render Pipeline (URP) in Unity 6000+. It ensures Mirror Networking’s example scenes remain visually consistent and functional in modern URP projects, addressing the shift from the default built-in pipeline (Unity 2019) to URP in Unity 6000.Key Features
.mat
files withinAssets/Mirror/Examples
and subfolders, preserving user project assets._Color
to_BaseColor
)_MainTex
to_BaseMap
, including_MainTex_ST
)_BumpMap
)_Metallic
,_Glossiness
to_Smoothness
)_Surface
)_SpecularHighlights
,_GlossyReflections
to_EnvironmentReflections
)Standard
,Legacy Shaders/*
) toURP/Lit
, skips URP-compatible shaders (e.g.,Skybox/6 Sided
).Motivation
Starting with Unity 6000, the built-in render pipeline is optional, and URP is the default. Without conversion, Mirror’s example materials (built for Unity 2019’s built-in pipeline) appear pink or incorrect in URP projects due to shader incompatibility. This script eliminates manual updates, ensuring a seamless experience for users upgrading to Unity 6000+.
Implementation Details
[InitializeOnLoad]
to check on project open, with a flag file (MirrorExamplesPipelineConverted.txt
) to prevent re-prompting..mat
files, and validates shader availability.Impact
Testing
Ground.mat
,Robot_Color
,Portal
)._GlossyReflections
and_SpecularHighlights
settings.