i have a szene with only unlit shaders, i add a point light (don’t ask why, this is just for explanation purpose of the problem i am having) and i get an increased drawcall count (less dynamic batching). Why? There is no lighting applied, so no need to not batch those things. Or is there anything i can switch on/off to avoid this kind of behaviour?
I’m asking because i wanted to use my custom lighting shader (3D tile shader), and realized that it adds drawcalls when adding a light. When using the shader with my own “custom Light” (casically just an empty Gameobject to get the position for my shader), everything is getting batched nicely.
Are you using deferred rendering? It probably still does a pass for each light even though none of the light ever gets used in the final pass. It likely doesn’t check beforehand whether all the shaders are unlit (especially since including lights in your scene is a big hint that you are not only using unlit shaders).
I did a quick test with forward rendering, and I didn’t see any extra draw calls for lights with unlit shaders.
I’m using forward rendering, and i checked it and could reproduce it in a REALLY simple scene:
Open a new Scene. create a Grid of cubes (10x10 in my example). Give them all the same (unlit/texture) material. Look at the drawcalls: 1 (as intended because of batching).
Now: Add a Point Light above them and change the Range so that not all cubes are affected. Look at drawcalls.
It is a definitely a bug, for now I can advice:
Put all your unlit objects into a separate layer and exclude that layer from light’s Culling Mask array.