The shadersA program that runs on the GPU. More info
See in Glossary in 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) use shader keywords to support many different features, which can mean Unity compiles a lot of shader variantsA verion of a shader program that Unity generates according to a specific combination of shader keywords and their status. A Shader object can contain multiple shader variants. More info
See in Glossary.
If you disable features in the URP Asset, URP automatically excludes (‘strips’) the related shader variants. This speeds up builds, and reduces memory usage and file sizes.
For example, if your project doesn’t use shadows for directional lights, by default Unity still includes variants that support directional light shadows in your build. If you disable Cast Shadows in the URP Asset, URP strips these variants.
If you want to examine the code that strips shaders in URP, check the Editor/ShaderPreprocessor.cs
file. The file uses the IPreprocessShaders API.
For more information on stripping shader variants, refer to the following pages:
To log how many variants Unity compiles and strips in total, follow these steps:
Editor.log
log file and search for ShaderStrippingReport
. For the location of Editor.log
, refer to log files.To log more detailed shader variant information, follow these steps:
Temp/graphics-settings-stripping.json
and Temp/shader-stripping.json
.For more information, refer to the following in the Unity User Manual:
By default, URP compiles variants where a feature is enabled, and variants where a feature is disabled.
To reduce the number of variants, you can enable Strip Unused Variants in URP Graphics settings and do the following:
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 let Unity strip variants related to a feature, make sure you disable it in all the URP Assets in your build.
Unity includes the following URP Assets in your build:
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 because this causes Unity to create two sets of variants for each keyword.
Feature | How to disable the feature | Shader keywords this turns off | Rendering Path |
---|---|---|---|
Accurate G-buffer normals | Disable Accurate G-buffer normals in the URP Asset. This has no effect on platforms that use the Vulkan graphics API. | _GBUFFER_NORMALS_OCT |
Deferred |
Additional lights | In the URP Asset, in the Lighting section, disable Additional Lights. |
_ADDITIONAL_LIGHTS , _ADDITIONAL_LIGHTS_VERTEX
|
Forward |
Ambient occlusion | Remove the Ambient OcclusionA method to approximate how much ambient light (light not coming from a specific direction) can hit a point on a surface. See in Glossary Renderer Feature in all Renderers that URP Assets use. |
_SCREEN_SPACE_OCCLUSION |
Forward and Deferred |
Decals | Remove the Decals Renderer Feature in all Renderers that URP Assets use. |
_DBUFFER_MRT1 , _DBUFFER_MRT2 , _DBUFFER_MRT3 , _DECAL_NORMAL_BLEND_LOW , _DECAL_NORMAL_BLEND_MEDIUM , _DECAL_NORMAL_BLEND_HIGH , _DECAL_LAYERS
|
Forward and Deferred |
Fast sRGB to linear conversion | In the URP Asset, in the Post-processingA process that improves product visuals by applying filters and effects before the image appears on screen. You can use post-processing effects to simulate physical camera and film properties, for example Bloom and Depth of Field. More info post processing, postprocessing, postprocess See in Glossary section, disable Fast sRGB/Linear conversions. |
_USE_FAST_SRGB_LINEAR_CONVERSION |
Forward and Deferred |
Holes in terrainThe landscape in your scene. A Terrain GameObject adds a large flat plane to your scene and you can use the Terrain’s Inspector window to create a detailed landscape. More info See in Glossary |
In the URP Asset, in the Rendering section, disable Terrain Holes. | _ALPHATEST_ON |
Forward |
Light cookies | Remove Cookie textures from all the lights in your project. | _LIGHT_COOKIES |
Forward and Deferred |
Rendering Layers for lights | Disable Rendering Layers for Lights. | _LIGHT_LAYERS |
Forward and Deferred |
Reflection ProbeA rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info See in Glossary blending |
Disable Probe Blending. | _REFLECTION_PROBE_BLENDING |
Forward and Deferred |
Reflection Probe box projection | Disable Box Projection. | _REFLECTION_PROBE_BOX_PROJECTION |
Forward and Deferred |
Render Pass | Disable Native Render in all Renderers that URP Assets use. | _RENDER_PASS_ENABLED |
Forward and Deferred |
Shadows from additional lights | In the URP Asset, in the Additional Lights section, disable Cast Shadows. | _ADDITIONAL_LIGHT_SHADOWS |
Forward and Deferred |
Shadows from the main light | In the URP Asset, in the Main Light section, disable Cast Shadows. The keywords Unity removes might depend on your settings. |
_MAIN_LIGHT_SHADOWS , _MAIN_LIGHT_SHADOWS_CASCADE , _MAIN_LIGHT_SHADOWS_SCREEN
|
Forward and Deferred |
Soft shadows | In the URP Asset, in the Shadows section, disable Soft shadows. | _SHADOWS_SOFT |
Forward and Deferred |
Enable Strip Unused Post Processing Variants in URP Graphics settings to strip shader variants for Volume Overrides you don’t use.
For example if your project uses only the Bloom effect, URP keeps Bloom variants but strips all other post-processing variants.
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.
Volume Override removed | Shader keywords this turns off |
---|---|
Bloom |
_BLOOM_HQ , BLOOM_HQ_DIRT , _BLOOM_LQ , BLOOM_LQ_DIRT
|
Chromatic Aberration | _CHROMATIC_ABERRATION |
Film Grain | _FILM_GRAIN |
HDRhigh dynamic range See in Glossary Grading |
_HDR_GRADING |
Lens Distortion | _DISTORTION |
TonemappingThe process of remapping HDR values of an image into a range suitable to be displayed on screen. More info See in Glossary |
_TONEMAP_ACES , _TONEMAP_NEUTRAL , _TONEMAP_GRADING
|
You should also enable Strip Screen Coord Override Variants in URP Graphics settings, unless you override screen coordinates to support post processing on large numbers of multiple displays (‘cluster’ displays).
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, you can disable the XR and VR modules. This allows URP to strip XR and VR related shader variants from its standard shaders.
If you create a custom Renderer Feature, you can use the FilterAttribute API to remove shader variants when you enable or disable settings in the URP Asset.
For example, you can do the following:
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.