Drawing multiple sprites cause a huge performance issue

Alright I’ve already asked this on answers but I did’t get any response so I’ll just copy & paste it here because I’m at a dead end at the moment and I can’t make any progress with this issue on hand.

I have about 150 sprites in the scene and the half of them are static and share the same sprite. Now what happens here is that I get about 50 draw calls along with the gui elements and my main camera which draws those sprites cannot draw them without decreasing the performance. I get about 38 fps when I’m supposed to get at least 59 and boy, isn’t it significant. The profiler indicates that Main camera has a hard time drawing “Render.TransparentGeometry” which breaks down to 3 more elements, the one with the hightest percentage says “RenderForwardAlpha.Render”. I’m guessing it’s because %30 of each sprite is transparent? If that’s the case how can I fix it? I mean this game engine is not that weak I know there’s a way to solve it.

RenderForwardAlpha means it is the transparent object queue into which the default sprite shader goes. It has nothing to do with the transparency of your sprite texture.

Measuring in fps is tricky as it tells me nothing about the actual time CPU spends doing things. What is the time in ms of your frame and the render calls? What device are you running on? Are the static sprites setup in a way so that Unity would understand that they can be batched?

For one, Profiling in the editor is always going to be of limited use. If you can profile on the device, you’ll get much more accurate results.

Second, 50 draw calls is a lot for a 2D game, and might be the source of your slowdown. Are your sprites packed into atlases?

“RenderTransparentGeometry” just means that it’s drawing a sprite that has an alpha channel (regardless of how much of that alpha channel is fully transparent) - since almost all 2D sprites have an alpha channel, you should probably just see this as “RenderAllMyStuff”.

I tried to run on 2 android devices : Samsung Galaxy S4 and and Samsung Galaxy Tab 3, S4 is obviously much better than Tab 3 and I almost have no issue with S4 but low end devices such as Tab 3 will surely have FPS issues. Now that I reduced the size of my sprites by compressing them, I managed to raise fps rate from 30 ± 5 to 50 ± 5. But I can’t do better than that. 50 ± 5 seems like a nice rate for a low end device, I guess.

Compressing the sprites shouldn’t have affected your framerate :eyes: Were there any other changes you made around the same time?

Nah, first I disabled gui cameras to see if they caused the problem but they didn’t change anything, so I disabled the main camera that rendered my sprites and my fps rate was always 59 which is ideal for an android game. Then I figured it could be my sprites and compressed them. they were around 30kb and I managed to reduce that to something around 3kb.

Hey, i know this Thread is old, but i also have performance issues with my Android game and it seams it causes because of my lot of Sprites. The Profiler showed me that Camera.Render/Drawing/Render.TransparentGeometry take ~50% of the performance, for All my Sprites i use Mobils/Particle/Alpha Belended , also i packed all Textures to a Atlas(via Unity Sprite Packer).

Did you solved your problem?

I’m sorry, I can’t exactly remember what I did to solve the issue but I think I just found an easy workaround by compressing my sprite files even more. That didn’t entirely solve my problem but It gave it a significant boost.