The DisableBatching
SubShader Tag prevents Unity from applying Dynamic BatchingAn automatic Unity process which attempts to render multiple meshes as if they were a single mesh for optimized graphics performance. The technique transforms all of the GameObject vertices on the CPU and groups many similar vertices together. More info
See in Glossary to geometry that uses this SubShader.
This is useful for shaderA program that runs on the GPU. More info
See in Glossary programs that perform object space operations. Dynamic Batching transforms all geometry into world space, meaning that shader programs can no longer access object space. Shader programs that rely on object space therefore do not render correctly. To avoid this problem, use this SubShader Tag to prevent Unity from applying Dynamic Batching.
This example code creates a SubShader with a DisableBatching value of True
:
Shader "ExampleShader" {
SubShader {
Tags { "DisableBatching" = "True" }
Pass {
…
}
}
}