Why is my game doing 175 SetPass calls and 2319 batches?

It’s literally just a few thousands textured quads and little else.

175 SetPass calls, 2319 Batches wit 0 saved by Batching, 838 Shadow Casters . . .

Are these numbers bad–it somehow seems like they are–, what would be making the count so high with a game that is literally about as complicated as the original Wolfenstein in terms of geometry and textures (and that’s about all I have in there right now), and how am I supposed to go about optimizing this kind of stuff?

The Unity manual for the Statistics Window suggests this is probably something I want to manage, but then doesn’t say a single word on how to actually do anything to do with this or how it works in games.


The topic is really huge and you can start digging it from: https://www.reddit.com/r/Unity3D/comments/34p6ld/can_someone_explain_what_setpass_calls_are_exactly/


You should check also Fram Debugger https://docs.unity3d.com/Manual/FrameDebugger.html.

It allows you to check why drawing another object costed with new DrawCall.

The general path to lower DrawCalls is:

  1. Minimize amount of used materials (sharedMaterials are great!)

  2. Minimize amount of dynamic objects.

  3. Static meshes can be combined into one mesh using one material since they won’t move.

  4. Realtime shadows are expensive. Maybe use lightmaps?

  5. UI elements also can have huge impact. You can use Sprite Packer.

I think that are just basics, but they will greatly improve performance of the game :slight_smile:

Man, I’m intimidated by most of that stuff you just said.

All I did so far was put in a few cubes and meshes and stuck some textures on them that I created as .png files from Photostop (maybe 30 images output at 512x512 just so the pixel are doesn’t look either all blurry or all jaggy), added a single directional light, put in a couple of character controllers and that’s about it. And now I have to worry about all this stuff you just mentioned. :-o

Guess I’ll add this to my link of Unity stuff I need to check out at some point. . . .

It’s becoming a pretty frikin’ long list.

PS. How do you do shared materials as opposed to just loading in single images into Unity and assigning them to objects as and when needed?