Other methods to warm up shaders
Warm up shaders if your build targets the DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs.
Read time 1 minuteLast updated a month ago
Warm up shaders if your build targets the DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs.
If your project uses the DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs, Unity provides multiple methods to warm up shaders in your project.
Use the GraphicsStateCollection API (recommended)
The GraphicsStateCollection API is compatible with DirectX 11, OpenGL, OpenGLES, or WebGL. On these APIs, automatically fallbacks to shader warm up. The API is the recommended method of warming up shaders. To learn more about warming up shaders with this API, refer to Warm up PSOs.
GraphicsStateCollectionGraphcsStateCollectionOther methods to warm up shaders
On DirectX 11, OpenGL, OpenGLES, or WebGL graphics APIs, you can also use the following methods to warm up shaders:
- To warm up a Shader object, use the Experimental.Rendering.ShaderWarmup API.
- To warm up all variants of all Shader objects currently in memory, use the Shader.WarmupAllShaders API.
To warm up a shader variant collection, do any of the following:
- Use the Experimental.Rendering.ShaderWarmup API.
- Use the ShaderVariantCollection.WarmUp API.
- Add the shader variant collection to the Preloaded shaders section of the Graphics Settings window. Unity then uses the to warm up the shader variants when your built application starts.
ShaderVariantCollection.WarmUp