Hi!, I have been reading about the great new 2d features in unity3d and there's something I'm not sure about: I use unity3d indie for ios and android. This devices are limited related to draw calls. If unity does not pack the sprites I import into it (creates a sprite sheet from them), does this mean I will have a draw call per sprite if they are all imported as diferent textures? Thanks in advance.
You can pack those sprites into one in a painting software and then in Unity (in import settings) you can unpack them into single sprites by selecting Multiple in Sprite Mode (making it a texture atlas that is fully editable in a Sprite Editor window). That means if you have all of them on screen it costs you only 1 draw call.
Not true, it will render every single sprite sprite, even if it is the same one, with a drawcall. This is so bad that the default tutorial wouldn't even run well on my tablet as it has over 30 drawcalls. So unless this is a bug, it seems that the 2D system is mostly useless on mobile (unless you buy $4500 worth of software).
I have the same amount of drawcalls whenever I add another part of my sprite on the screen (by sprite I mean one part of the big texture atlas sprite, each one is an object with a Sprite renderer attached).
When I tested it out it seemed to work OK for me (not on pro). But I haven't tested in Build. I used a texture with import settings Sprite - Multiple,making two texture "slices" in the Sprite Editor. I created two sprite game objects, each using a different texture (slice). Stats when playing: Draw Calls 1, Saved by batching: 1 Do you have Sprite Packer enabled in Editor Settings?
Wait, from what I understand, the Sprite Packer is a Pro Only Preview, so it will be available for Unity Free too. In the future. Here it says: ...with one exception, all our new 2D features are currently available in the free version of Unity And then: - Save on textures with automatic atlas generation (Pro preview) - Optimize your fillrate with alpha cutout (Pro only)
No, even with sprite packing disabled it automatically combines sprites using the same texture. I can see this by making a sprite, duplicating it a few times, and the "saved by batching" number in the stats goes up while the draw calls remain at 1. --Eric
Looks like batching breaks if the object has a collider on it. Plain sprites do indeed batch just fine, wether it's the exact same sprite or just atlassed. Put a collider on it? Every sprite now has it's own drawcall. EDIT: My problems are indeed due to a bug, but it's not the collider. I have absolutely no idea what is triggering it and I cannot replicate it in a new scene.
Yeah, I've been trying to replicate the bug but I can't nail it down. I've sent in a bug report, because in a new scene it does indeed batch.
Sprite Packer is a Pro Only feature. The wording on that page is not perfect. Free users can still use atlases created using 3rd party software. Currently there are no plans to enable this in Unity Free.
So, instead of importing separated spritesheets on Unity Free, I should make an atlas with lots of sprites before, and import that?
There are some sprite batching tools in the asset store...costs about $15 I think, works on pro and free.
Although I'm not a Unity expert I can recommend TexturePacker for packaging sprites together http://www.codeandweb.com/texturepacker
I'm having this problem of multiple draw call when using the same atlas and material. I suppose this is a problem related to the animator. I've made a few copies of a character with the new 2d animation system, changing sprites + moving, scaling, rotating them. (My character is composed by a series of sprites, something like the tutorial but with more hierarchy inside the character) Each copy is giving me 8 draw calls, although all sprites are at the same texture. Am I missing something??
I solved this issue, it was not related to the animator. My problem was I was using an -1 scaled sprite for the arms. I've researched and saw that this change in scale breaks the batcher. I'll leave both posts here if someone gets the same problem already know something to start with =)
There's also : http://richardjdare.com/blog/2012/11/atlasmaker-0-7-make-texture-atlases-in-photoshop/ If you want to stay in Photoshop.
For sprite batching on free version, I also recommend TexturePacker. For automatic slicing, here is an importer for TexturePacker https://github.com/f15gdsy/TexturePackerImporter, it's based on http://forum.unity3d.com/threads/217408-TexturePacker-to-Sprite, but I made some minor extension. Hope it helps
Yes, I encountered this issue, and I experimented a bit on this. I have a sprite sheets with 5 frames, and they are s0, s1, s2, s3, s4, (in sequence as displayed in the Project window). At first, I set all of them scale to (1, 1, 1), and the draw call is 1, saved by batching 4 Second, I set s0's scale to (-1, 1, 1), and the draw call is 2, saved by batching 3 Third, I set s0 back to default and set s1 to (-1, 1, 1), and the draw call is 3, saved by batching 2 Forth, I set s0 to (-1, 1, 1) again, and keep s1 as (-1, 1, 1), and the draw call is 2, saved by batching 3 Finally, I set s0, s2, s4 (1, 1, 1), and s1, s3 to (-1, 1, 1), which results in draw call 5, saved by batching 0 NOTE: if we replace -1 with any positive number, they are all batched. So I think Unity's batching works like this, loop through the sprite sheet for frames (in the sequence you see in the Project window), and batch frames that have the positive/negative scale together, and continue to loop and batch those whose scale have negative/positive number, and continue to batch in this way.
Hey. I have a problem when the texture atlases greater than 1024x1024 such as 2048x2048 so I drawcalls counted more than one. I have a texture in the 3 sprites and still counting 3 drawcalls. When switching to 1024x1024 is drawcalls one on one texture which is correct. You do not know what the problem is?