By default, the Universal Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary (URP) compiles both shaderA program that runs on the GPU. More info
See in Glossary variants where a feature is enabled, and shader variants where a feature is disabled. This can increase the number of shader variants in your build exponentially, depending on how many features you use.
To remove a feature and its shader variants, do either of the following:
If you need a feature for your project, you can instead make sure you enable it across your project in the Editor settings, so Unity can strip the variants where the feature is disabled.
Important: When you reduce shader variants, Unity might strip shader variants your built project needs. To check how many shader variants your project has, enable strict shader variant matching, otherwise Unity might replace missing shader variants with others. For more information, refer to Check how many shader variants you have.
To make sure Unity strips unused shader variants from your build, follow these steps:
If you disable the Strip Unused Variants setting, URP can’t strip variants where the feature is disabled. This might increase the number of variants.
To remove the shader variants for a feature, disable the feature in all the URP Assets or Universal Renderer assets in your project, or elsewhere in the Editor settings.
For a list of settings, refer to Settings and keywords reference for stripping keywords in URP.
If a setting is in the URP asset, make sure you disable the feature in all the URP Assets included in your build. Unity includes the following URP Assets in your build:
Note: Avoid including URP Assets in your build that use different rendering pathsThe technique that a render pipeline uses to render graphics. Choosing a different rendering path affects how lighting and shading are calculated. Some rendering paths are more suited to different platforms and hardware than others. More info
See in Glossary. This can cause Unity to create two sets of variants for each keyword.
For a list of keywords in prebuilt shaders in URP, refer to Settings and keywords reference for stripping keywords in URP.
Follow these steps:
_ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS.To keep a feature but still reduce the number of shader variants, refer to Enable dynamic branching in prebuilt shaders.
To strip shader variants for Volume Overrides you don’t use, follow these steps:
To disable the shader keywords for a post-processing effect instead, refer to Settings and keywords reference for stripping keywords in URP.
Unity checks for Volume Overrides in all scenes, so you can’t strip variants by removing a sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary from your build but keeping it in your project. You must remove the scene from the project.
If you don’t use XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info
See in Glossary or VRVirtual Reality More info
See in Glossary, disable the XR and VR modules. This allows URP to strip XR and VR-related shader variants from its standard shaders.
To examine the code that strips shaders in URP, check the Editor/ShaderPreprocessor.cs file. The file uses the IPreprocessShaders API.