文档

Unity Engine


User Manual

Script Reference

Unity Engine


Reducing shader variants

Reduce the number of compiled shaders in your project.
阅读时间1 分钟最后更新于 1 个月前

Strategies for reducing shader variants to optimize builds and performance.

Page

Description

Introduction to shader variantsUnderstand how Unity compiles shaders into multiple shader variants.
Check how many shader variants you haveUse the shader logging and profiling tools in Unity.
Reduce shader variantsPrevent Unity compiling shader variants.
Reduce shader variants in custom shader codeUse the
#pragma
directive or preprocessor macros to limit shader variants in custom shaders.
Default keyword setsResources for the default shader keywords in Unity, and creating sets of built-in keywords.

Additional resources