Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Sprite Packer

Discussion in 'Assets and Asset Store' started by Darkcoder, Dec 14, 2013.

  1. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Indeed, this is one issue that I can't exactly fix because sprites inside a multi sprite can't have their own PPU :(

    I guess I should put a warning in the inspector that the PPU values are mixed.

    In general though your game should use the same resolution assets for everything, perhaps the UI/background/scene/etc could use different values, but in that scenario it would make sense to use multiple atlases to group them up so they can then all share the same PPU.
     
  2. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    At the very least it needs that warning. Fortunately I took a back right before I clicked the Link button or I would have been screwed.

    You also might want a warning when you aren't sure of the target Sprite. I had some sprites with identical names but different graphics. Both added but it mixed up the targets.

    Still a great asset. I think offering to scale them in the Sprite atlas so the different PPI values are taken into account would be a useful option.

    Thanks
     
  3. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Actually I just realised that the scale set on prefabs is used on instantiate, it is only the position and rotation that isn't.

    So you could automatically adjust the scale transform as part of the Link step. You would also need to add a Scale transform to each animation step for animated sprites too.

    EDIT: Scratch that last step. Scaling objects in scene and prefabs would be enough. If it isn't used in those two locations then it isn't going to be used in your game.

    PS somehow my Atlas and the texture it creates have become unlinked. When I click not he Atlas object (unity icon) it shows no sprites, but the Texture exists showing me all the sprites it contains. Is there any way to relink them?
     
    Last edited: Oct 29, 2015
  4. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    If you enable the debug inspector you should see a field in the atlas called 'Identifier'. This stores the GUID of the atlas texture, so you can open your atlas texture's .meta file and copy + paste the GUID from there into the 'Indentifier' field, or maybe do the opposite.
     
  5. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Thanks, I think i've done that but it doesn't look right. I have put the GUID from the Textures.meta file into the Identifier field of the Atlas.

    It now shows the texture in the preview inspector for the Atlas, but it isn't showing any existing sprites are in it. The Sources and Sprites arrays are still empty.
     
  6. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    If there are no source sprites then you'll have to remake the atlas. Did you reset the atlas component or something? As there should be no other way to destroy all that data.
     
  7. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    I restored the Assets directory from a backup. No problems, recreated now. Thanks
     
  8. ExcellS23

    ExcellS23

    Joined:
    Sep 22, 2015
    Posts:
    9
    Hello, I am having an issue from which when I update my atlas to create the atlas sheet, the program creates the atlas sheet, but the UI message is still showing up stating "Reimporting....". Tried restarting and trying again, but it still does the
    same thing.

    upload_2015-12-29_12-9-8.png
     
  9. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Do you see any errors in the console when this happens?

    If it imports correctly then any messages like that should get removed.

    Perhaps remove one texture from your atlas at a time until the issue goes away, and confirm that it's just one texture that's causing the issue. Then maybe send that texture & meta file to me so I can see what's going on?
     
  10. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    I would love to see an unlink option, I just linked a lot of sprites only to find out the PPU values are mixed, and thus creating a mess. back to the backup.
     
  11. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    If more people want this feature I can add it, though storing references to modified objects across scenes sounds a bit hacky. Maybe I should just add a check to warn if you about mixed PPU values.
     
  12. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    What my main workflow would be is making use of bought sprites from the asset store and using them in a scene, and putting them in a constantly updated spritesheet,

    so that if I ad or remove a sprite from the pack the it wil be automatically updated, and if I remove on sprite from the sheet, the original link should restore for that sprite.
     
  13. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,521
    I also would like to request a make sprite atlas from current scene sprites only.

    And if sprites are added or removed from the scene they would update the atlas
     
  14. febix

    febix

    Joined:
    Jun 2, 2013
    Posts:
    12
    My Sprite Atlas have 2048x1024 texture size. PVRTC for iOS requires a square, power of 2 texture. What is the best way to fit my atlas to square, maybe cut one atlas to 2 pieces of 1K?
    Do you have in SpritePacker any features to get square texture? Thank you.
     
  15. febix

    febix

    Joined:
    Jun 2, 2013
    Posts:
    12
    Thank you very much.
     
  16. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Thanks for pointing this out. I sent you an updated version that should fix this :)
     
  17. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    Question: Is there a way to tell the Sprite Packer to not split Multisprites when importing them into an Atlas?


    Reasoning : If I have a button, which is sliced with the Sprite Editor, I don't want the middle tiling sprite to be placed elswhere in the atlas. I want it to be next to the rest of the button, because when I use compression for the output atlas image, the loss of quality will not be uniform in the Tiling part versus the edge of the button.

    Regards
     
  18. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Have you experimented with Pad Style = Clamp/Repeat, and Pad Size = 2/4/8?

    If the Pad Size is right I think it will produce uniform compression.
     
  19. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    Hello, yeah we did tried those settings, but the problem is really that with a lot of sprite in an atlas our sliced buttons are not positioned together in the Atlas.

    So, one of the edge is besides greenish textures for instance and the middle tiling get placed besides blueish textures, so then when we put them back together in the game, the artefact created by the compression are different, since their surroundings were.

    Edit:
    Actually, it might work with a super high padding, but it's not an option for us, we have so many sprites, we want to compress it for mobile devices and we need to have the smallest atlas we can!

    Edit 2:
    So basically, my initial question of forcing multiple sprites to stay together in the Atlas, this isn't possible?
     
    Last edited: Mar 7, 2017
  20. ForceMagic

    ForceMagic

    Joined:
    Feb 27, 2015
    Posts:
    38
    Nevermind, we wrote some code to enforce a whole texture to be copied all together :) thanks anyway
     
  21. Leewoosuk

    Leewoosuk

    Joined:
    Mar 31, 2017
    Posts:
    1
    Hi. Thank you for creating such a wonderful tool. I'm Basic user. I would like to know how to revert back to before clicking the "Link Sprites" button. I use to 2.0.8 version. It is hard not to be able to turn back. Please let me know soon.
     
    Last edited: Mar 31, 2017
  22. erpatton

    erpatton

    Joined:
    Oct 6, 2014
    Posts:
    55
    Oh my god... I wish I had read this forum before using this. I had quite a few PPU differences, and this ruined everything. I figured, "No problem! I'll scale the images to what the PPU was at, set the PPU back to 100, and then update the atlas, which will update the size of the image!"

    ... Nope. Updating it fixed maybe two things and left everything else the screwed up size for some reason. Please, please add some kind of warning that checks for any PPU not set to 100. I'm so tired from working on all of this today just to have this kind of crap happen right when my day was supposed to end.
     
  23. sygaki786

    sygaki786

    Joined:
    Jan 26, 2014
    Posts:
    142
    I have tried various tileset editors but I have the same problem with all of them. I can't get the tiles to be cut evenly. I have an existing tileset - tiles_spritesheet.png. I have additional images which are loose. I packed them using the asset store Sprite Packer tool. The result from Sprite Packer is Atlas.png. The images in the sprite sheet are cut properly. I have uploaded all those images. When I upload Atlas.png in any tile editor, the tiles don't slice correctly. I am currently using 2D Tilezone and others too. The issue is that the tile size is fixed like 32*32 etc whereas the sprites are of different sizes.

    Please advise. When packing in Sprite Packer is it possible to make all the images multiples of 32*32? Maybe that would keep them help them be cut properly?

    The 2 tile sheets and a couple of the loose images are attached.

    Thanks,
    Arshad
     
  24. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
    Hello, I would like to purchase your asset, I saw a friend of mine using it but it seems lacking a major functionality for mobile.
    Let's say I want to support certain android devices that can only use 2048x2048 textures (max size), using your plugin, I should be able to define a max size and then have the plugin splice texture into more than one file.

    I testing it on my friend's machine by downscaling a 4096x4096 atlas to 2048x2048 but it creates werid artifacts on the edges of the sprites.
     
  25. shark812

    shark812

    Joined:
    Dec 6, 2012
    Posts:
    13
    I really need the same UNLINK function, or at least a script to do that. Thanks!
     
  26. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Sorry for the late reply everyone, I didn't get any notifications until now for this thread.

    Interesting, can you detail what modifications you made? I don't imagine it's a trivial change.


    I've now added this feature and will submit it later today.


    Sorry for the issues! The inability to edit individual PPU is indeed one of the biggest issues with making your own atlases, and Unity's SpriteMetaData struct still doesn't allow it to be set. Adding a PPU warning is a great idea and should have been added from the start, I'll include it in the upcoming update.


    I don't see any attached images. Sprite Packer isn't really designed for sprite atlases that require every texture to be a uniform size and be placed in a uniform grid, mainly because such a setup would most likely cause texel bleeding across the edges. You can disable edge padding to get this though, or if your sprites are say 30x30 then a padding size of 1 would make each of them 32x32. I recommend you allow the packer to put them anywhere and then you read the packed positions from the actual Sprite data though, that way you get the huge benefit of edge padding, and the ability to pack other sprites in too.

    This feature was not added on purpose, because splitting an atlas into multiple textures can cause unpredictable draw call results. If you want this ability then I recommend you use Unity's built-in Sprite Packer. This asset is mainly aimed at people that want full control over how each individual sprite is packed, and the final texture.
     
  27. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Thanks for pointing this out. You can change this from SpritePacker/Editor/SpAtlas_Editor.cs line 32:

    Code (csharp):
    1. [MenuItem("Assets/Create/Sprite Atlas")]
     
  28. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Hi Carlos, I've just bought this fine asset and it's indeed very easy to use. However, I may have misinterpreted one of its features, so I'd like to ask you if what I need it's possible or not.

    My artist is making backgrounds that consist of multiple layers in Photoshop. They pretty big, around 5400x1080 pixels in size and, as I mentioned, they have multiple layers. But let me show you...

    This their scene layout:


    This could appear like a single sprite but it's actually formed by seven:


    The reason I have them configured like this so I can make a parallax effect.

    Now, my artist sent them to me as a Photoshop file, so I exported them as they were and I obtained seven 5400x1080px independent images. Like this...:




    (and so on...)

    I didn't know at the time how incredibly expensive this is in terms of wasted memory and processing power. I'm an amateur and still learning...

    But yeah, I went and imported the PNGs to Unity as single sprites and put them all in a single object:


    ...with these import settings, btw..:


    All of them have a 'Center' pivot point, so I didn't need to align them at all. And this was very convenient at the time, of course. Problem is that, as I mentioned, this is very inefficient.

    So I went and experimented with the Unity Sprite Editor at slicing layers like that foliage one:


    That seemed alright and much better, but the problem is that their pivot points remain at the center, instead of being readjusted to remain at the center of the whole image. What I want is something like this instead...:


    ...so I could add these trimmed sprites into the root object and they stay in their original position.

    And of course, manually repositioning these smaller sprites is something I don't even contemplate as a possibility.

    Therefore, I searched for some magical asset that could do this for me and stumbled upon yours. But I have misunderstood something because it seems that the original sprites don't get trimmed as I expected, and when I take a look at the atlas sprite sheet this is what I find:


    A pretty huge atlas of 8192x8192 pixels, containing my original sprites as they were, with their pivots set at their respective centers, even though they read 'Custom'.

    I used this setting in the Atlas:


    So... is there some way to achieve what I need?

    Sorry for the huge post, but you know what they say about images and words... ;-)

    Thanks for your time.
     
  29. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Interesting problem, this isn't something I considered when developing Sprite Packer. However, you can still get your intended result if you export every layer as a separate texture, then pack them all with Sprite Packer separately. The default packing textures should automatically remove the transparent edges and retain the original pivot point, allowing you to simply drag and drop everything in and have them positioned as expected.
     
  30. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Thanks for replying so quickly.

    Uhm... I'm not sure I follow you. Those layers are already independent (single) PNGs in Unity, so when I drag them to Sprite Packer and press Update (with Trim checked), I kind of expected the result you mention (being trimmed and their pivots repositioned).

    Nevertheless, I think that my main issue comes from the fact that Unity Sprite Editor is lacking a feature that I consider basic...: the ability to lock the position of a sliced sprite pivot in the exact middle of its master image (or sprite sheet, whatever it's called).

    Thing is, my original plan was to slice and trim these BGs in smaller chunks in Sprite Editor, then use your plugin to take advantage of its better performance. But my 'evil plan' was foiled when I found out that I couldn't reposition the slices pivot points to the center of the bigger image. And of course, trying to manually position them would be stupid on my part as I need pixel-grade exactness.

    What it baffles me is that if you press Ctrl you can do that exactly, but only inside the slice. It would be incredibly trivial (?) to add another modifier key like Alt to do the same outside the slice, but it seems that Unity guys didn't come up with this idea in all these years. And it seems that no plugin authors realized this lack of functionality also because I've been searching for an alternative Sprite Editor to do this without success.

    I'll admit, however, that my way of assembling backgrounds could be a little unorthodox on my part, probably because my artist doesn't have experience in game development and paints whole scenarios as an image.

    I know I could tile all the background layers in a grid, or something similar. But I sincerely think that my method would be far better, as the only thing I'd need to do would be to slice and trim in Sprite Editor (an automatic process) and, as long as the slices retain their pivot points at the center of its parent image, I could put them all inside one GameObject and use it to move around the whole thing, perfectly aligned.

    So... my question for you now would be more like...: Would you be able to modify Unity Sprite Editor to include an additional pivot setting to these...:



    It could be called "Original Center" or something like that. :D And for bonus points, if it could be possible to make an Alt modifier key that behaves like the Ctrl key, but outside the slices... that would be awesome.

    Obviously, I understand this would be outside the scope of your Sprite Packer plugin, but if you do that for me I'll be more than happy to pay up to $60 for a plugin that does that. It would be a great time saver for me.
     
  31. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Oh right, I misunderstood what data your layers contained.

    If your source image is this (ignoring the sprite rectangles):


    then Sprite Packer cannot pack this as you describe, since such an operation could output any number of sprites, and be incompatible with Unity's normal workflow.

    However, if you exported the contents of the 4 rectangles to separate textures (but the same size without trimming), then Sprite Packer would be able to trim them while keeping the original pivot point while still removing the pixels not inside a rectangle.

    One alternative that I could easily add is where the rectangles have their pivot points set to the center when packing, thus giving you the desired result, but it would require you to draw the four rectangles in the sprite editor.

    The feature you describe to change a sprite's pivot to match the original sprite is also possible, but it would best be done using a context menu option or similar, because modifying the actual Unity Sprite Editor is a bad idea.

    If you don't require this feature immediately then I can add it to my to-do list and add it as soon as I have more free time?
     
    Last edited: Aug 15, 2017
  32. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Ah, you mean that for Sprite Packer to actually trim something it needs to detect that all slices are the same size? Ok, that would explain why it didn't trim anything I passed it over. :p

    If that was the case then I could do something like this:



    A grid by cell count. But I'd still have the same problem of the new pivot points being at undesired positions...

    Edit: As an experiment, I've done this with just four slices, but they didn't get trimmed...: o_O



    But I'd need more than four actually... The main point here is to slice the original sprite in a way that the least transparent area is drawn. And if I keep their number to four identical sprites, this is what I've got after they're trimmed...:



    That's not optimal. It would be best if it was something like this...:



    I've sliced these manually, starting from an automatic slicing process. But again I have the same problem as always...: pivot points are centered inside the slice.

    I understand. I don't usually upgrade Unity until a project is finished, but I can see the potential issues in that approach. That's why I tried to find an alternative Sprite Editor.

    But if you could add an option to Sprite Packer to modify every pivot point, for the sprites inside an atlas, to calculate a new one based on their respective original images... that would be awesome.

    The only potential issue I foresee... What would happen if the new pivot point for an image ends outside of the atlas image? Would still work as intended?

    Well, 'immediately' would be a harsh demand on my part. :rolleyes: Let's say that as soon as possible and I'd try to manage in the meantime.

    Edit: that thing about the four identical slices not being trimmed by Sprite Packer also got me puzzled, btw... that's not supposed to happen, right?

    Edit2: wow, it seems that the problem was that I set 'Pad Style' to 'Clamp' when adding the textures to Sprite Packer atlas, and it needed to be 'Transparent' so the 'Trim' option gets activated at all! Why it needs to be transparent for the trim to happen? I still need these sprites to be positioned alongside and I don't want to get seams...: :(



    I guess this problem would not happen if I use non-trimmed cell-style sprites, right? But for that to work, I'd need the pivot problem addressed.

    Why is this so hard, WHY !? :confused:
     
    Last edited: Aug 15, 2017
  33. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    No, but if they're all the same size then the original pivot points will be the same without any extra action on your part, or additional scripts. This means that when Sprite packer packs each layer and trims the empty pixels, it will calculate the correct pivot points.

    Indeed this doesn't work, because Unity automatically places the pivot in the center.

    As far as I know there is no issue with pivot points being outside of the sprite.


    Trim only works with transparent textures because there's a clearly defined way to trim them. Trimming non-transparent textures is possible by using some border pixel as the trim color, but this wouldn't actually render correctly unless your sprite shader uses a color key or additive blending to make the edges transparent.

    Anyway, I highly recommend you try the method I tried to explain, as I'm pretty sure it will fix your issue right now without waiting for me to add anything. Just to reiterate, you MUST export every piece of foliage in its own unique texture that has the exact same width&height, the only difference being each texture must only contain the solid pixels for that part of the foliage. This will cause each foliage texture to have the exact same original pivot point, and Sprite Packer will then trim the excess edge pixels and calculate the correctly offset pivot points.
     
  34. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Problem with this is that the original pivot points are not set at the center of the master image. It always comes to this.

    I think that the misunderstanding comes from the fact that you assume the foliage layer is composed of various smaller images, already positioned and anchored. But that's not the case. This is what I've got when my colleague sends me a background:

    What I import to Unity are all these images. Then I place each sprite inside its own object, which in turn are inside a 'Graphics' parent object, which is the one I actually transform. They're also sort layer ordered.

    So, if I pre-cut outside of Unity these images in smaller pieces, to avoid transparency rendering, I'd need to manually position each of them inside the "canvas" parent object, which would be very time consuming and inaccurate.

    Therefore, what I wanted from the start was to be able to slice them with the built-in Sprite Editor, but then discovered to my horror that it didn't have a way to keep the pivot at the center (0,0) of the master image and that ANY slice operation I did would move it to another place.

    Actually, I've already done what you propose (more or less). I've made in Photoshop this image:


    It's 5400x1080px, the same dimensions as the scene layers.

    Then, in Unity, I imported the image and sliced it by cell size to 108px (my PPU setting). This got me this:


    Then I proceeded to reposition ALL the 500 slices' pivot points to the exact center of the image. I was able to do this only because all cells are identical and fit in the master image perfectly, so I could use integers when typing in the coordinates:


    Then, after filling in all the 500 cells coordinates, I resourced to a free plugin to copy this template's settings to the other images, so I ended up with something like this:


    Finally, I erased (manually again) all the unneeded transparent slices:


    And this is what I send to Sprite Packer's atlas. And as these slices are already small enough I don't need to trim them, something I need to avoid as Sprite Packer doesn't trim them in 'clamp mode' (as you already explained).

    This whole process is moderately time consuming and has the additional hassle of needing to open the .meta file for each PNG file (to search and replace slice names), as all of those slices get names from the template and that causes problems with the link feature.

    A MUCH more ideal solution would be to slice 'by cell count' in Sprite Editor, which would not create unneeded transparent slices, and then Sprite Packer change each slice pivot point to 'custom' and calculate the exact position for them to be at the center of their respective original master images.

    Nevertheless... I'm going to use this workaround for the time being, but if you could add this functionality to Sprite Packer... man, I'd be VERY happy for that. :p

    Thanks for your time.
     
  35. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    I understand this, what I'm saying is that to get the result you demonstrated you need to create these smaller (contents, not resolution) textures for it to work with Sprite Packer as-is. If you do this, then Sprite Packer can trim the excess, and you can still enjoy the automatic pivot point calculation without too much extra work. For example:



    If you split the original into these 3 (or more) textures then they will pack and behave exactly as expected. Making these images may take a bit longer, but it's kind of similar to how it would work if you were to define the rectangles in the sprite editor anyway.

    Regarding the grid idea, this is interesting and could work, but it also presents several issues. Most notably, it isn't unity-like at all, as you'd have to drag and drop potentially lots of sprites to get your scene filled in, and making updates to the source textures or modifying settings would require a lot of tedious work. These tasks could be handled by some special component or menu, but that's still quite a bit of work to handle all edge cases. Secondly, such a system wouldn't work well with the PolygonCollider2D system, leading to loads of colliders that probably have very bad shapes, loads of GameObjects that don't send collision data to one central location, and probably many other issues.

    Another big issue is that over time users move on to newer versions of Unity, and version 2017 comes with a sprite atlas system that's basically identical to Sprite Packer, so I don't think there's enough demand to make the development time worth it. It may be better to implement such a feature using Unity's new atlas system as a backend.
     
  36. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Oooh, now I understand! An image is worth thousand words indeed. :p

    I'm going to test this right away.

    Well, it works... but it's also true that since I've implemented this, the error console has started to throw errors related to frames not being rendered on time and other obscure issues that I never got before. And that without even running the game.

    Oh, and the Scene view pans at a crawl speed now, btw... so yeah, I'm inclined to think this is a very bad idea after all. :(

    I won't upgrade to 2017 anytime soon, but I see your point. I've also suggested in Unity to implement that absolute pivot point alignment in Sprite Editor, but I don't have high hopes as it seems that I'm a very weird developer doing things the opposite way from the rest of people. :rolleyes:

    So I'll revert the code to a previous version and start testing your suggested method.

    The only "problem" I foresee is that I'll need to manually extrude sections I need to cut in half so they are less than 4096px (I'm targeting really old video cards), but I suppose that's not a big issue.

    Thank you for taking the time to clarify all this to me.
     
    Darkcoder likes this.
  37. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Wow... I'm still the last one commenting... :p

    Well, I have a very simple question this time. I need to force Sprite Packer to use a maximum of 4K atlases to maintain compatibility with DirectX9 videocards, but even though I've set the importing settings like this:



    ...Sprite Packer uses sprites bigger than that if I try to pack more images than a 4K sprite would support, instead of giving me an error.

    Something I could do, instead of trial and error?
     
    Lars-Steenhoff likes this.
  38. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    SpritePacker is designed to generate up to 8192^2 atlases, you can easily change this behaviour though.

    You just need to open SpPacker.cs, and modify line 94, which should look like this: if (testWidth > 8192 || testHeight > 8192)

    Just change those to 4096, and it should give you an error as expected.
     
  39. Abelius

    Abelius

    Joined:
    Nov 11, 2016
    Posts:
    37
    Awesome, thanks!
     
    Darkcoder likes this.
  40. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    My email address is in the Read Me.pdf, or on my asset store publisher page This asset isn't dead, it's just isn't so popular any more.

    What's the exact version of Unity you're using? What Android build settings are you using? Which exact Android device do you experience this issue on? If you can send me a .unitypackage of the atlas you're using I can try it on my android devices.
     
  41. SuperMiro

    SuperMiro

    Joined:
    Nov 23, 2018
    Posts:
    51
    Hey, @Darkcoder I'm interested in this package but just wondering what extra features does it give over Unity Sprite Atlas ??
     
  42. SuperMiro

    SuperMiro

    Joined:
    Nov 23, 2018
    Posts:
    51
    @Darkcoder and do you still support it ??

    Thanks in advance :)
     
  43. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Yes, this is asset is still supported. This asset was written before Unity's Sprite Atlas system existed, so it's mainly aimed at users on older Unity versions. If you're using a newer version then I don't think there's any benefit.
     
    SuperMiro likes this.
  44. mrkotfw

    mrkotfw

    Joined:
    Oct 27, 2012
    Posts:
    10
    I just purchased Sprite Packer, and I'm getting the following errors:

    upload_2020-7-17_17-14-42.png

    This is due to L21 in
    Editor/SpAtlas_Editor.cs
    . It's fixed by explicitly specifying
    UnityEditor.Editor
    instead of just
    Editor
    .

    Also, please wrap all your classes in a proper namespace. Something like:
    SpritePacker
    and
    SpritePacker.Editor
    .

    Thanks.
     
  45. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    Thanks for pointing this out. I guess your project has a class called "Editor" in the global namespace that's causing this file to fail compilation? This file has using UnityEditor; from which it uses Editor.
     
  46. mrkotfw

    mrkotfw

    Joined:
    Oct 27, 2012
    Posts:
    10
    I might have. All my scripts are encapsulated in their own namespace(s), so it's probably a rogue plugin or external script. I'll double check and address it on my end.

    Also, with about 70 sprites, the tool takes about 10-15 minutes to pack. Is there a way to debug Sprite Packer, or a quick call stack the preferred way? The problem is that it locks Unity up, so I'm unable to capture the area that is causing the issue.
     
  47. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    147
    Hi. I can see this forum is sleeping from last year but I am facing a small issue using Sprite packer. The problem I am facing is related to Prefabs.
    When I try to use LINK feature of Sprite Packer, it doesn't link inside prefabs. I don't know if this is something that's not possible for dev to implement or someone didn't face this problem before me. @Darkcoder sir can you please add this feature or fix this? Or at least share some workaround to fix this? Thanks, :)
     
  48. TheDylonFive

    TheDylonFive

    Joined:
    Mar 27, 2015
    Posts:
    8
    Hey! Was trying to use the TryAddSource in code, does that work or is it not a fully working feature?

    I added path correctly and got no warning bout incorrect path, but it doesnt show up in the atlas source after I run the code

    Is there something i have to do to get it to work? Or does that feature not work? Thanks! Otherwise great plugin! :)
     
  49. TheDylonFive

    TheDylonFive

    Joined:
    Mar 27, 2015
    Posts:
    8
    Oooo just kidding it works!! I forgot to add ".png" at the end of the path ahahah whoops, solid plugin!!
     
  50. Darkcoder

    Darkcoder

    Joined:
    Apr 13, 2011
    Posts:
    3,404
    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!
     
    umair21 likes this.