- Home /
dynamic batching problem with spriterenderer
Hello,I have a question for dynamic batching about spriterender.
Here is the thing.
firstly, I create a prefab (name prefab1) which with one child ,and the child has Spriterenderer which sprite reference is sprite1.png
secondly, I create a prefab (name prefab2) which with two child ,and each child has Spriterenderer which sprite reference is different (like sprite1.png and sprite2.png), and each child has same loaclPosition,localRoation and localSacle.
Now,I have code below this:
public class test1 : MonoBehaviour {
//first reference prefab1
//second reference prefab2
public GameObject prefab;
void Start()
{
for (int i = 0; i < 100; i++)
{
GameObject tmp = Instantiate(prefab) as GameObject;
}
}
}
Hero is a result : First
Second
Hero is my Question: Why the dynamic batching results is different ?? the sencond test drawcall is too high ?!
PS:I has test later, only if prefab2's childs has different localPosition ,they can dynamic batching,and the draw call can be 2 !
PS:I know if set material.color could't dynamic batching.
Answer by jamesk5 · Sep 12, 2016 at 11:31 PM
i think you're supposed to use sharedMaterial, not material.
Your answer
Follow this Question
Related Questions
Problem with 2D Sprites and draw calls 1 Answer
Performance Hit of Adding Many GameObjects? 1 Answer
Sprite renderer, bad perfomance on mobile 1 Answer
Sprites performance issue 0 Answers
Unity - Repack sprites at runtime 0 Answers