- Home /
Static batching only working with default diffuse?!?
Come across a bit of an oddity that I am unable to account for nor finding any previous examples of anyone having this specific problem elsewhere.
I have started work on a city generation script that uses a 2D array as a grid and places the same prefab floor tile to create the map floor, and initially static batching seemed to be working fine with editor testing reporting 3 draw calls and 3827 batched (using a larger grid to judge higher end load as I work on things).
However when I changed the tile prefab material from the default diffuse to a Diffuse/Bump shader static batching stops working completely even though nothing else has changed.
I have checked to make sure that the tiles aren't using instances of the material, and have also tried a few other shaders such as bumped/specular, specular and even made a custom bumped shader using Strumpy Shader Editor... but it seems static batching has completely stopped functioning for anything other than the bog standard diffuse material.
Is there something I am missing about static batching that could account for this by chance? Or is it safe to say this is a bug?
Edit: Forgot to mention, I have also created a new scene and tried dropping the prefab into the scene a few times to see if the problem was caused by my script, and the behaviour remains consistent and batching only shows as functioning using simple diffuse.
Additional information:
Unity version - 3.5.0f5 (latest release)
No real time or baked lighting is in place to interfere with the static batching.
I'm not sure but it is possible that static batching only works for one-pass shader or fixed function. Can anyone confirm that?
If this is the case, it strikes me as rather odd based on previous questions and forum threads I have read with people talking about static batching alongside transparent shaders and the such.
I am still slowly learning though and I will admit my knowledge of the guts of a shader is very basic so you could be right $$anonymous$$ryptos but if so it would seem static batching is rather ineffective at what it is meant to do surely?
Answer by Tikigod · Apr 07, 2012 at 03:38 AM
Ok, I did not realise that static batching was a Pro-Only feature as there wasn't any clear indication of it being so on the Unity webpage for batching.
So turns out my problem is that when changing the shader from a diffuse to a bumped diffuse that dynamic batching stops working rather than a problem with static batching which was never being used to start with.
As there are already a load of reports of dynamic batching problems with Unity 3.5, this question is pretty much closed I'd say.
Your answer
Follow this Question
Related Questions
Does material's shader realtion with batching ? 1 Answer
Why does the frame debugger say node uses different shader when it isn't? 0 Answers
Material doesn't have a color property '_Color' 4 Answers
Dynamic batching breaks with the material Mobile/Alpha Blended. 0 Answers
How to know if my Shader Graph is supported by the SRP Batcher? 1 Answer