- Home /
Sprite Batching / Sprite Materia
I am having the following situation:
1 have 50 Sprite Render objects attached to 50 game objects inside a scene.
The Sprite renderers all have the same sprite attached , which is inside a texture atlas. I am using the Sprites-Default shader. All the sprites have are on the same z position.
In the editor while the game is not running the Material slot shows "Sprites-Default". If I open the frame debugger, I can see that all 50 sprites are rendered in one batch.
Now I start the game. The Material changes to "Sprites-Default (Instance)". In the frame debugger I see that all 50 sprites get rendered in separate draw calls, giving me 50 more draw calls.
If I select the sprites in the editor while the game is running, and apply the Sprites-Default material again, the sprites get batched properly again.
My question are
Why does unity create instances of the Sprites-Default material? I thought the instances are created only if some properties of the material get changed.
In the inspector I can see a yellow warning triangle saying "MaterialPropertyBlock" is used to modify these values if I expand the Sprite-Default material. What does this mean exactly ?
Do you have any other components on thise sprite objects? A script that tries to access renderer.material, perhaps?
No there is no other component on the sprite objects.