Sprite Packer (523054)

NOTE: This asset has been deprecated from the Asset Store because Unity now comes with its own built-in Sprite Packer tool that largely does the same thing, and the sales from this asset aren’t strong enough to justify my time to update it.
If you’ve purchased Sprite Packer then you can still download it, but it will no longer receive any updates. I understand this will disappoint some users, so to make up for this:
All customers are automatically eligible to get a free copy of my new Lean Texture+ asset, which allows you to do texture channel packing, generate normal maps, and many more really useful texture modifications. You can find the new asset HERE, where you should be able to download/install it in any project running at least Unity 2019.4.12.
Sorry for any inconvenience!

What is it?

Sprite Packer is an easy to use tool that can efficiently pack your textures and sprites into a single sprite atlas.

Why would I need this?

If you’re using Unity’s new 2D features then you might have noticed your draw call count going through the roof.

If you’re making a mobile game, then keeping your draw call count down is vital, and this tool makes it incredibly easy to do so.

Why should I use this instead of the alternatives?

  • Sprite Packer is the easiest to use by far. Everything about it was designed to make sense, while giving you full control.
  • Sprite Packer automatically rebuilds texture atlases when it detects changes. This speeds up workflow a lot.
  • Sprite Packer works with any texture or sprite, so you don’t have to fiddle about with the texture import settings.
  • Sprite Packer trims the edges of all your textures to save space (can be disabled too).
  • Sprite Packer is designed to work with terrain tile sheets, so you don’t have to worry about ugly seams at the edges.

What’s the workflow like?

Step 1: Create a Sprite Packer

Step 2: Add Some Textures

Step 3: Tweak Packing Settings

Step 4: Make Your scene

Enjoy 1 Draw Call

You can also watch a video of it in action.

Where can I get it?

You can get it from the Asset Store.

Thanks for reading. If you have any questions, feel free to ask!

2 Likes

Hi,

How do you manage the pivot points?
How do you exactly manage the removing of sprites inside your Atlas? I see in your video that you keep the reference of the sprite, what if I remove 1à sprites? You keep every reference? Is it related to the IDs Unity is using concerning sprites?

The latest version has two pivot point modes:

  • The first is to centre the pivot point after the image is trimmed. This is useful for just generic sprites with lots of random whitespace around them.
  • The second is to retain the pre-trimmed pivot point. By default this pivot point will be the centre of the image (i.e. if you send Sprite Packer a normal Texture), but if you pass a Sprite or a Multi Sprite then you can specify your own pivot points using Unity’s Sprite Editor, and as long as you don’t hit trim within that editor, it will work very well for animated sprites that have a lot of whitespace around them, but need to act as if the whitespace is still there.

I don’t know if I explained that well, but I will be making an updated tutorial video to showcase this new feature.

To remove a sprite from the atlas you can either delete the source texture and rebuild the atlas, or set the texture entry to null and repack it. Doing this will completely remove the sprite from the atlas texture, but the actual sprite entry will remain. This is because sprites inside a multi sprite are referenced using a Sprite reference and integer index, so I can’t actually remove the sprites from the sprite array without potentially corrupting some scenes.

This is not true from my experiences. I have a few sprites I need Pivot Left, and without trimming, and specifying Left pivot, they still seem to be center pivot on the sprite sheet. Am I doing something wrong?

Other than that, this is a great time saving asset.

Interesting, I just did some testing and it seems that custom pivot points don’t work correctly if your source sprite has the Sprite Mode set to Single. This appears to be a bug with Unity, because the texture importer’s spritePivot value always returns 0.5, 0.5, regardless of what you set.

However, you can work around this issue by setting the Sprite Mode value to Multiple, and just set up one sprite.

I will release an update that warns you if you try to pack a sprite that uses the Single mode in combination with Keep Pivot. Thanks for pointing it out.

Great! Thanks… I’m surprised this asset hasn’t gotten any reviews - i’ll write one later today.

In the 1.0.6 release, one of the change log notes was “Remove Missing Sprites” option added to SpritePacker context menu, however I can’t seem to find that option while highlighting the SpritePacker prefab and right clicking. Is the option somewhere else?

Yeah, you either need to click the gear icon in the SP_SpritePacker inspector, or right click the component name:

Hi, would your tool allow us to import a texture that’s a little image in a big empty box, and keep the entire empty box as a tile rather than trimming out all the unused space? Our images are all created within the same canvas area, and we are layering those images on top of each other, so need to keep the exact placement within the box.

Yes, this feature was introduced in Version 1.0.5, and the ‘Trimmed Animation’ demo scene shows it in use.

If you choose to buy it and have any issues then please post here :slight_smile:

Great tool, very useful! Exactly what I had expected Unity to put in with their Atlas support, but was missing. I do have a request for the next version: the ability to either set default values for the Trim/Keep Pivot checks, or a way to mass set those values. In our game we need to turn off Trimming for almost everything we put in there, and it’s a pain to do it one by one, and hope we didn’t miss one.

Good idea, I just added this feature. I also found a solution to the Keep Pivot value not working with Single sprites. However, it seems assets are currently taking ages to review, so if anyone wants an advance copy then send me a PM!

[Edit] Seems like it was quick this time. Version 1.0.9 is now live!

Hi, I just grabbed the latest version of SpritePacker, and if I use that version to Rebuild an old SpritePacker prefab, I end up with a whole bunch of “Missing” things in the resulting Atlas. All the sprites seem to be present in the Atlas (after all the “Missings”), but prefabs referencing the sprites that used to be in the Missing section lost their references.

In version 1.0.6 I fixed a bug where Unity would throw errors under certain circumstances (due to a Unity bug). Unfortunately, fixing this bug meant that all texture and sprite references would be lost, forcing you to essentially redo your atlases.

I added a warning to the Version 1.0.6 release notes about this, but perhaps I should have carried the warning over to more versions. If you don’t need the new features added in 1.0.6/1.0.7/1.0.8 then I can send you a copy of 1.0.5, which should still be compatible with your current atlases.

Hmm, we actually started with version 1.0.7 before upgrading to 1.0.9. But we’ve only used it for a couple atlases so far, so I can recreate them.

Strange. The texture and sprite references are just GUIDs, so maybe something caused those to change? I could make it harder to break in future versions by also storing a path as a fallback.

-Does this work with the free version of unity? I realize you have to buy this, but does it work fully with the free version of unity?

-Can the sprites that are packed together be used for animation? I already have all my animations and prefabs set up using separate sprites. Will I have to recreate these in the animation/animator window, and then update the prefab?

-Will I have to recreate the prefabs for all of my objects using the new sprites in the sprite packer? If the sprites are potentially all gathered from the sprite packer, will I be able to then delete the old singled out sprites?

  • Do the sprites put in to the sprite packer all have to be the same size? I use relatively small objects, but things like fences are wider than things like bushes. Some clarification here would be nice.

Let me know! I’ve been searching on the internet and cannot find definitive answers.

Yes, it fully works with the free version of Unity.

Yes it can be used for animation (it includes an example scene of this), but you will have to set your sprite references up again. This is because it doesn’t modify your existing sprites, it instead creates a new set inside an atlas.

You don’t have to delete your old sprites, but you will have to update the Sprite references inside your SpriteRenderer components.

No, the sprites you put in the packer can be any size you like.


If updating up the sprite references is an issue, then perhaps I could make a tool that finds all references to the unpacked sprite, and replaces them with the packed version. But I’ll have to investigate this quite a bit, as the last thing I want to do is damage any prefabs or scenes!

[Edit] I just finished writing this tool and submitted it to the Asset Store. It will come with Version 1.1.0 :slight_smile:

Hi, i was thinking to buy Sprite Packer but i have a doubt about it:

Can i put my atlases in the resource folder and load the content inside them directly with script?
I’m asking this because, as far as i know, the built in packer for unity pro dosen’t give you this possibility and i have no clue if this tool can do it.

Yes, in c# you can use: var myAtlasSprites = Resources.LoadAll(“YourAtlasPath”);