To many 2d drawcall make the game slow

To many 2d drawcall make the game slow

I will have at lease 100000 2d sprite on the screen. When the camera big enough to see them, I find the game is so slow.
For The 100000 sprites are also very small, but the drawcall is still big. and how can I do?

I think the camera must render one single sprite to be just a pixel . but seems upset :frowning:

Do you really need 100,000 independently moving / animating objects?

Well 100,000 is a lot of objects, no matter what. In order to get that to batch to, say, less than even 50 drawcalls, you’d need 2000 objects in each batch, which I think is unlikely to happen. Also not just the batching/drawcalls, but the sheer overhead of processing 100,000 objects… dealing with all those transforms, generating the geometry, pushing it to the gpu etc… you might not notice it with 5000 objects but at 100,000 it adds up.

Are all the sprites static ie they don’t move, or are they like tiles in a grid, or are they all dynamic?

Hi

they have a parent root that will move and rotate

They are tiles in grid, they are using unity native 2d sprite.

When the scene really far , too many draw call

More , The parent root will rotate around y axis in order to show another side 2d tile grid

More , do there a way to put 2000 objects in each batch?and generating the geometry, pushing it to the gpu ?

Any information will be really helpful to me . I was crazy to this problem

Well Unity sprites already get batched and use a spritesheet. You do have one spritesheet texture that is shared by all of the tiles, right, not like 100 different textures?

Yes just one

Fell a little upset, still cannot solve the problem :frowning:

Use shuriken and set positions manually. This is pretty damn fast (not quite point sprite speed but good enough).

Hi hippocoder, thx anyway

More , I cannot catch the idea on how to set positions manually , any more information is god to me , sorry for noob.

More, some of the tiles have collider2d , and the color of them are dynamic.

i think you will prepare a big sprite that contain all of the sprites you want to show

I will provide the player dynamic to destroy single part of the tile.
If they are a big sprite, I cannot destroy it as part

If it is 100,000 objects making up one huge object the individual objects must either be tiny or all not onscreen simultaneously.

If tiny like a few pixels or less you could simply make larger objects. Say you represent whatever with 6,250 4x4 pixel objects instead of 100,000 1-pixel objects. The player destroys the 4x4 objects which breaks off and then you can shatter that piece down into 16 1-pixel bits.

If the object is massive and not all on-screen then deactivating any objects that are off-screen should speed things up.

But then what happens when he zooms out and all objects are showing?

WOW ,hi imaginaryhuman , I found I have paid for your Gradient Shader Pack ,reaally good asset :slight_smile:

But then what happens when he zooms out and all objects are showing?

when I zoom out , more sprites go into the camera and be slower :frowning:

Thx GarBenjamin :), thx for your suggestion , your solution maybe the only solution ,I cannot control the camera how to render the sprite, can I? what I can do is only to combine , but It will need a lot of work for too many logic in on the 2d sprite :frowning:

I must have missed the bit about needing to zoom out. Really don’t know what is being made. With it being sprites I figured it was 2D and there would be no zooming.

I can zoom the camera and rotation the 2d object in the camera, the 2d object have six different faces with their own collider, single 2d object is one tile :frowning:

  1. make array of type Particle[ ] here: Unity - Scripting API: Particle

  2. set up shuriken how you like, but don’t animate them. Instead you move the manually with this: Unity - Scripting API: ParticleSystem.SetParticles

Don’t use GetParticles as this is slow. Just modify the Particle objects in your own array then use SetParticles. I can’t help more than this.