Skip to content

Unity: rendering and shaders

Render pipelines, draw calls, shader keywords and variants, shader warm-up, textures, level of detail and the rendering debug tools. The engine-independent rendering rules are in Graphics and GPU rendering. Profiling, memory and asset loading are in Content and performance, and frame budgets are in Game development.

Entries are sorted by score from 1 to 10 (criteria): 9โ€“10 start here or strongly recommended, 6โ€“8 recommended, 1โ€“5 further reading or conditional.

Adopted references

Unity's URP guide and the graphics sections of the Unity Manual are the baseline. The rules below add the choices and settings that are easy to miss.

Key rules

Render pipeline and draw calls

  • 9 UNITY-GFX-1 Start new projects on the Universal Render Pipeline (URP), and choose HDRP only for a PC or console project that needs its high-end features. Don't start a new title on the Built-in Render Pipeline. Unity deprecated the Built-in Render Pipeline in Unity 6.5 and supports it through the Unity 6.7 LTS lifecycle, plans no new HDRP features, and warns that switching pipelines late in development is very time-consuming, because the pipelines use different shaders. This applies GFX-1. (Unity, Render pipelines strategy for 2026, Unity Manual, Choose a render pipeline)
  • 7 UNITY-GFX-2 In URP and HDRP, follow Unity's draw-call recommendations: enable the SRP Batcher and the GPU Resident Drawer, turn off static batching and the materials' Enable GPU Instancing checkbox, share materials, and use Material Variants rather than MaterialPropertyBlock for objects that differ only in property values. The GPU Resident Drawer needs the Forward+ or Deferred+ rendering path and a graphics API with compute shaders, and it lengthens builds because it keeps all BatchRendererGroup shader variants. This applies GFX-10. (Unity Manual, Choose a method for optimizing draw calls, Enable the GPU Resident Drawer in URP)
  • 7 UNITY-GFX-3 Write custom shaders in Shader Graph by default, bring in hand-written HLSL through Custom Function nodes, and keep any fully hand-written URP or HDRP shader compatible with the SRP Batcher. Unity's URP guide finds Shader Graph the more convenient route for most custom shaders. A hand-written shader is compatible when it declares all material properties in one UnityPerMaterial constant buffer and the built-in engine properties in UnityPerDraw, which the shader's Inspector confirms. (Unity, Introduction to URP for advanced creators, Shader Graph, Introduction to HLSL in Shader Graph, Unity Manual, SRP Batcher compatibility)

Shader variants and warm-up

  • 7 UNITY-GFX-4 Declare keywords that only materials set with shader_feature_local (in Shader Graph, keep the keyword's default Shader Feature definition), keep multi_compile for branches that C# switches at run time, and use dynamic_branch for simple, balanced branches on fast GPUs. multi_compile compiles every keyword combination whether or not a material uses it, and builds leave out shader_feature combinations that no material uses, so never switch those at run time. This applies GFX-6. (Unity Manual, How Unity compiles branching shaders, Toggle shader keywords in a script, Shader Graph, Introduction to keywords)
  • 7 UNITY-GFX-5 Strip the shader variants the build doesn't need, and check the count after every build: turn on Strip Unused Variants and Strip Unused Post Processing Variants in the URP Graphics settings, turn off unused features in every URP asset the build includes, remove keywords in Shader Build Settings (Unity 6.3 LTS and later), and strip the rest with IPreprocessShaders. Search Editor.log for Compiling shader to see the counts, and turn on Strict shader variant matching in test builds to catch variants stripped by mistake. This applies GFX-6. (Unity Manual, Reduce shader variants, Strip shader variants in URP, Check how many shader variants you have, IPreprocessShaders.OnProcessShader)
  • 7 UNITY-GFX-6 On DirectX 12, Vulkan and Metal, record the pipeline state objects (PSOs) the game uses into a GraphicsStateCollection from a development build, one collection per graphics API and platform, ship the collections, and warm them up during loading screens with WarmUp or WarmUpProgressively. Don't rely on ShaderVariantCollection warm-up on those APIs, because it can create the wrong PSOs. From Unity 6.1, GraphicsStateCollection also falls back to shader warm-up on DirectX 11, OpenGL and WebGL. This applies GFX-5. (Unity Manual, Introduction to PSO tracing and warming, Trace and manage PSO data collections, Warm up PSOs, Other methods to warm up shaders)

Textures, level of detail and debugging

How to enforce

Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.

  • 7 Unity Project Auditor, Shaders view: lists each shader's SRP Batcher compatibility, keyword count, and potential and built variant counts, and the Shader Variants view lists the variants in the build and, from a development build's Player.log, which of them were compiled at run time. Runs from the command line in CI. Partly checks UNITY-GFX-3, UNITY-GFX-4 and UNITY-GFX-5.
  • 7 Unity build log, shader variant counts: after each build, Editor.log reports for every shader pass the full variant space and the counts left after settings filtering, built-in stripping and scriptable stripping, which a CI step can compare with a budget. Strict shader variant matching makes test builds show the error shader and log any variant that was stripped by mistake. Partly checks UNITY-GFX-5.

Tutorials and further reading