SpriteRenderers spend alarming amount of time culling, considering porting to GL calls

I’m alarmed at how much time is spent on recalculating bounds and culling sprites in a purely 2d game. >10ms per frame on some Android devices, which cascades into dropped frames, which makes fixed update get called multiple times, which makes the whole thing go to the framerate crapper and have a hard time coming back.

I would gladly disable sprite culling, as it’s simply not necessary for my simple 2d game. Back in the days of making gameboy games, we spent 0ms culling sprites on way wimpier hardware.

I’ve been working in unity for a few years and have already followed every piece of advice in this video (which is the best I have seen so far on making unity almost somewhat performant):

  • including getting rid of Update(), calculating my own quaternions, no Vector math, no GC, no API calls unless deadly necessary, etc. It seems the way to make unity go fast is to use as little of it as possible.

Is getting rid of SpriteRenderers completely and just making my own GL calls the next logical step? Or is there a way to really disable culling? The occlusion culling checkbox on the camera of course does nothing.

I should add, I am on 5.6.0p2, but this problem has been around for a long time.

Also, the really good stuff in that video starts about 28:40 in…

Turning OFF dynamic batching appears to help. My draw calls are already carefully managed so I don’t need that. it’s still ridiculous though.

You could try disabling Dynamic Batching per shader instead of the whole thing by adding “DisableBatching”=“True” under the tags of the shader.

This way you can keep dynamic batching for the rest, could be usefull on the long run.

What would be greatest is being able to disable scene culling for spriterenderers. Occlusion culling also makes no sense for anything in the transparent render queue…