Check how many shader variants your build has in URP
Log how many shader variants Unity compiles and strips.
阅读时间2 分钟最后更新于 9 天前
Use logging to check how many shader variants Unity compiles if you use the Universal Render Pipeline (URP).
To log how many variants Unity compiles and strips in total in URP, follow these steps:
- Open the Graphics settings window.
- Open the URP tab.
- In the Additional Shader Stripping Settings section, select a Shader Variant Log Level other than Disabled.
- From the main menu, select File > Build Profiles.
- Enable .Development Build
?
- Build your project.
Unity logs the shader variant information to the following locations:
- The Console window
- The log file. Search for the section that begins with
Editor.log. For the location ofShader Stripping, refer to log files.Editor.log
For each shader, Unity uses the format . For example, the following log indicates that Unity kept 8 of the 39 variants of the Lit shader, including 1 of the 6 vertex shader variants of the shader pass:
Total=<Number of variants in build>/<Total number of variants>(<Percentage in build>)ForwardLitUniversal Render Pipeline/Lit - Total=8/39(20.51%)- ForwardLit (ScriptableRenderPipeline) (SubShader: 0) (ShaderType: Vertex) - Total=1/6(16.67%) - Time=0.0691ms...
To export the information in JSON format, follow these steps:
- In the Graphics settings window, open the URP tab.
- In the Additional Shader Stripping Settings section, enable Export Shader Variants.
- Build your project.
- In your project folder, open the and
Temp/graphics-settings-stripping.jsonfiles.Temp/shader-stripping.json