Start with the exact incompatibility reason
SRP Batcher reduces CPU setup work for rendering. If compatibility is reported as missing, select the target Shader and inspect its SRP Batcher status. Shader support and a particular Renderer meeting the requirements are separate checks. Keep the tested object, Material, and rendering pass fixed while comparing results.
If compatibility is already confirmed and your concern is unchanged draw count, use the separate CPU optimization guide.
| Finding | Isolation check | Correction to investigate |
|---|---|---|
| Shader Inspector reports incompatibility | Read the actual message and inspect generated/handwritten passes | Consistent numeric material constants in UnityPerMaterial |
| URP Lit works, custom shader does not | Use the same mesh and renderer with a temporary control material | Custom declarations, includes and pass differences |
| Shader is compatible, renderer uses a different path | Temporarily remove the property-block writer in a test scene | A material-based alternative, if measurement supports it |
| A batch ends at another draw | Read Frame Debugger variant/pass information | Different variants can split batches without shader incompatibility |
1. Separate shader problems from renderer problems
- Duplicate the affected object into a small test scene. Preserve its mesh and replace its material with a standard URP Lit material as a control.
Inspect preparation cost and draw count separately - If only the custom shader fails, inspect that shader's compatibility status and compile errors. If both behave unexpectedly, confirm the active URP asset and the renderer type.
Inspect preparation cost and draw count separately - Search scripts for SetPropertyBlock and GetPropertyBlock, including animation or per-instance color systems. Disable the writer only in the test setup. Clearing a block once will not help if another component reapplies it next frame.
Inspect preparation cost and draw count separately - After changing a material strategy, compare both correctness and CPU cost. Replacing every property block with a unique material is not a universal optimization.
Inspect preparation cost and draw count separately
2. Check constant buffers in handwritten shaders
Group the material's numeric constants into one UnityPerMaterial constant buffer. Keep the material layout consistent across the relevant passes. Leave texture and sampler declarations outside that buffer. Use the pipeline's supplied includes for Unity's built-in per-draw values rather than declaring competing copies.
// Layout illustration only: not a complete shader.
CBUFFER_START(UnityPerMaterial)
float4 _BaseColor;
float4 _BaseMap_ST;
float _Cutoff;
CBUFFER_END
TEXTURE2D(_BaseMap);
SAMPLER(sampler_BaseMap);
Do not paste a second buffer into a shader that already declares one through another include. For Shader Graph, first inspect the graph target and generated shader. Editing generated output directly is fragile because regenerating the graph can replace those edits.
3. Verify the corrected renderer and pass
Recompile, revisit the Inspector status, and use Frame Debugger to inspect the same draw. Check the active material, shader keywords and pass rather than a different nearby object. A split caused by another variant is different from a shader failing its eligibility check.
Keep a short before/after record: Inspector message, shader/pass, whether a property block is applied, and the draw's rendering path. Then use Player CPU timings to assess any performance benefit. The retained diagram explains CPU preparation; it is not proof that a particular shader passed this checklist.
References
- Unity 2022.3: SRP Batcher, compatibility and profiling
- Unity 6.0: shader and GameObject compatibility
- Unity 2022.3: MaterialPropertyBlock
If you see “No SRP in use”
First identify the active render pipeline. In Unity 6, the current Quality level’s Render Pipeline Asset takes priority; if unassigned, Unity uses the Default Render Pipeline Asset in Graphics. If neither is assigned, Unity uses the Built-in Render Pipeline. If Built-in is intentional, adding an SRP is not necessary. If URP is intended, record the current settings and check the active Quality and Graphics assignments. Labels and where this message appears vary by Unity version.