[RELEASED] Static Sprites

Static Sprites on the Unity Asset Store

Discord Support | Email
Static Sprites is a lite tool to optimize the rendering of non-moving sprites. The improved performance means you can now render thousands of sprites on even low-end mobile devices without a hitch!

As a technical background, Unity normally dynamically batches the rendering of sprites as an optimization. Dynamic batching means it groups the geometry into similar renderable batches each frame, and this generally works pretty well for small moving geometry. However, dynamic batching is not optimal for non-moving sprites, since the CPU still does a lot of work constructing the batches each frame. If you open the Unity Profiler or Frame Stats, you can check the Dynamic Batching batched draw calls count. That is all the redundant work, since the sprites don’t move.

Static batching on the other hand, is much faster as it pre-generates the batches and geometry to be rendered just once. However, Unity’s static batching system only works for meshes, unfortunately. Toggling the Static checkbox on sprites does nothing.

That’s where Static Sprites comes in. Simply attach this component to a game object, and any sprite that is in the hierarchy under it is statically batched on start. It does this automatically, intelligently combining sprites into singular meshes while respecting differing materials, textures, atlasing, colors, sorting orders and layers, and Flip XY direction.

Features

  • Automatically static batches non-moving sprites
  • Supports differing textures, colors, materials, atlasing, sorting layer ID, sorting order, and Flip XY
  • API to unbatch sprites as well
  • Support for exporting combined sprites to a folder outside Play mode

And that’s it! If you are using sprites in your game, this is essential for optimization.
Increase your framerate, save battery life, and render more sprites!

Static Sprites released!

If we are using an atlas already and if draw calls are caused by sorting layers, will this help render em in a single call?

Hi, in this case, the tool will statically batch the sprites into groups based on similar atlases and sorting layers. So if for example you have 3 sorting layers, that will result in 3 draw batches. The benefit is that it eliminates the overhead of dynamic batching of the sprites each frame.

Hope that answers your question!

basically if a sprite is used multiple times in different sorting groups it does get duplicated into different atlas. is that correct?

Hi, in this case, there would be one texture atlas generated for the sprite, and then for each sorting group a separate draw batch.

I wonder if this supports spatial partitioning? Otherwise it would be a really nice feature for a lot of games. For example if you build a larger level in a 2D plane you wouldn’t want to merge everything into a handful of draw calls, since that will submit a ton of redundant geometry. In that case you would want the user to be able to for example to specify some bucket sizes to split into to a grid. This is even more important if you don’t use a quad as mesh type.