- Home /
Sprites: Too many setpass calls?
Hey folks,
First here's a few stat screens to get my point across:
I'm new to Unity so I don't understand what is happening. I am using Unity's Sprite packer. So there should be a total of 4 drawcalls for all the sprites (body sprite, weapon sprite, healthbar, and shadow blob). All sprites use default sprite material. I was under the impression if sprites use same material and that material is using same texture (in this case should be 4 different textures), then they'll all get batched together? What am i missing?
EDIT: If I put all sprites in same spritepacker and disable blob shadows, the setpass calls stay at around 50-70. As soon as blob shadows are enabled it goes up to the 500+ range again. Why does batching fail when the blob shadows are drawn?
Answer by Baste · Aug 26, 2015 at 06:27 PM
Blob shadows are created by projectors. Projectors have this great feature where they add one draw call per other mesh they hit. So even if your sprites are batched, the blob shadows are not. Be sure to have the blob shadows set to only hit the layer you want them to hit - ie. the ground, and nothing else. They might be trying to blob on your sprites for some reason.
Try turning off the blobs one by one, and see what effect each one of them have individually. Also remember that draw calls are not born equal, and the important thing is the end performance, not the draw call number.
If you really want to dig into what each drawcall is, you can check out the frame debugger.
Ah, thank you! Your explanation on the projectors helped a lot. The ignore layer was the key that I was missing. Now each new "unit" only adds 1 more to setpass calls for the shadow projector ins$$anonymous$$d of 4+. In the end I may ins$$anonymous$$d use a shadow sprite placed under them but for now performance is acceptable.
Your answer
Follow this Question
Related Questions
Masked sprite batching 0 Answers
How to instance custom sprite shader? 0 Answers
Sprite batching 1 Answer
Orthographic mode and Z coordinate for 3D meshes? 0 Answers
Sprite batching 1 Answer