I need to reduce batches count. Unity's brilliant feature "Dynamic Batching" is killing me :D My game contains a lot of smaller objects that keep changing when players interact.
- Dynamic batching does not work good even though I assign one among desired number of materials to the objects. The game starts with the batch count of '3' with 81 objects using the same material. If I change an objects ,material it shows '4' batches which is OK because there are 80(mat01) and 1(mat02). When I change another object to mat02, the count should stay '4' right? But its not! It keeps increasing till mat02 becomes majority and the batch count reaches '3' when everything is changed to mat02. Why do you wait for crowd Unity?
- Regardless of this habit of Unity, I decided to use some lerp in the material color. Then obvious things happen. If I change a property of an object's material, the material becomes "mat01(instanced)" and be instanced forever costing a batch forever. If I assign mat02, it shows "mat02(instanced)".
It feels like a punishment. "Dont touch my material.. I will cost you forever!!!" What is the problem? Yes... I changed that material. Now I assign a brand new material whats difficult for you to assign this poor guy(gameobject) back to the peer(batch)???
I also read Dynamic batching can not be modified through script.
I will keep updating the story till I reach what I want. Guys please point where and all I am doing wrong.
Updates: 1. An Awesome explanation about coloring materials This link taught me good things and these lines impressed me more, "Any change to a material, such as setting the color of the material, results in a new material instance, and therefore that object will no longer batch. But using vertex colors allows the changing of color of objects without breaking batching." I will try this and update.
- I solved the issue by using vertex coloring. Performance looks good. I achieved what I needed exactly.