Same Sprite in multiple sprite atlases breaks dynamic batching

I use the same sprite in two sprites atlases for dynamic batching in different situations, but unity always uses the same (first) atlas. Because of this dynamic batching breaks in the second scenario. I dont want to import the same sprite twice and all the sprites in the same atlas is too big. Does anyone have an idea how to achieve dynamic batching in both situations?


First I import the sprite sheet (smoke animation) and cut it with the sprite editor (different smoke states as separate sprites). Then I use the sprites in my scene. After that I create a sprite atlas and add all sprites of the scene that should be batched together (smoke sprites, cactus sprite and so on). This works without any problems.

In a different situation I also need the smoke animation. Because of that I create a new sprite atlas (cannot use the first one, because of the size) and add the smoke sprites with some other. But batching doesn’t work here, because unity uses the wrong atlas for the smoke sprites: First the right atlas is chosen. Then unity switches the atlas because of the smoke sprites. After that unity uses the right atlas again.

I know that i could optimize the scene with a different order of the sprites. Nevertheless there is one extra draw call for the smoke animation.

None have a solution? Is it possible to import the same image twice? I don’t want to switch the sprite in multiple folders if something changes.

I’m unsure why you would want to waste texture memory by storing the same sprite twice, as an extra draw call doesn’t really hurt much. Either way, the reason why dynamic is breaking is because you have two different sprite objects, with two different references. You need to switch between them (more overhead) when you switch sprite sheets.