- Home /
Modifying material after instantiation breaks batching
I've read in one of the posts that if you have a bunch of game objects that uses the same material, it gets batched into one "group". But if you were to modify the material, it basically clones and creates a new material. I was wondering if there were ways to modify the material without breaking the batches.
I have a script attached to these game objects and in the Start(), I cache the material in order to modify the material's color value.
m_Material = GetComponent<MeshRenderer>().material;
But I think this is causing the material to be cloned and create a new batching. I cant use "sharedMaterial" because not all game object's material color will be modified in the same frame. I was wondering if there was a way to achieve this without breaking the batching, but also being able to modify a number of game object's color. Any help would be greatly appreciated.