Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official Sprite Atlas v2 in Unity 2022.1 beta

Discussion in '2D Experimental Preview' started by rustum, Nov 26, 2021.

Thread Status:
Not open for further replies.
  1. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
    Sprite Atlas v2 in Unity 2022.1 beta
    ℹ️

    Unity 2022.1 has been released with these new improvements in Sprite Atlas. Let's continue the discussion here!

    Sprite Atlas 2.png

    Great news for 2D and Sprite Atlas enthusiasts! Sprite Atlas v2 updates are now available with the Unity 2022.1 beta.

    What’s new?
    Sprite Atlas v2 is the default in new projects
    Sprite Atlas v2 is now the best atlassing solution we provide. Therefore from this version forward it will be the default atlassing option in any new Unity project. Sprite Atlas v2 brings support for Unity Accelerator and as of 2021.2 has provided full support for folders as packable objects.

    Sprite Atlas v2 now supports Presets
    This means that you can make presets of Sprite Atlases that contain settings for packing, platforms, textures and secondary textures.

    About Sprite Atlas v2
    Read more on the current Sprite Atlas v2 manual page here.

    What can you do?
    Try it out and let us know what you think of the additions and improvements. We want to know what works as expected, what doesn’t and what is missing. We’d love to see how you use them as well, so please show off all the cool ways that you've used Sprite Atlases in your projects!
     
    NotaNaN likes this.
  2. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Great, I'm glad you're still working on improving sprite atlas which is a fundamental core aspect of 2D performance. I've already posted elsewhere (https://forum.unity.com/threads/2d-system-optimizations.805905/). To reiterate, sprite atlas is one of those core "performance by default" things that isn't sexy, but really helps all Unity games that utilize this feature. The atlas being a generated asset is a great thing about V2. However, it's still missing the efficiency of modern packers (spine, atlas maker) and I want it to be better.
    A) Generate the best/efficient tight mesh
    B) Better analyze all meshes and generate more efficient packing.
     
    Luka-Maske likes this.
  3. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    846
    Backporting this to 2020?

    Also, something that's really needed is being able to access an atlas by sprite path in addressables.
    I have lots of sprites whose addresses are stored in configuration files for my custom made levels and thus I load them at runtime, but I have no way of knowing in which sprite atlas each sprite is. I'm currently investigating into creating a custom sprite atlas importer that creates a .bytes file that contains the paths of all sprites, but it feels like 'reinventing the wheel'.

    In other words, I want to call Addressables.LoadAsync<Sprite>("Assets/Res/2D/Characters/Monsters/Monster1/IdleAnimation/frame1.png") and get the sprite, optionally getting SpriteAtlasManager.atlasRequested fired the first time any sprite from this atlas is requested, where I also choose waht variant of the sprite atlas to load: LD, SD or HD.
     
    NotaNaN likes this.
  4. Luka-Maske

    Luka-Maske

    Joined:
    Jul 2, 2015
    Posts:
    13
    @rustum we are trying to use sprite atlas for a big mobile game mainly to pack lots of ui sprites. The main issue I have with is algorithm for creating tight meshes is not as effective as it could be.
    Before we were using "https://www.codeandweb.com/texturepacker" upload_2022-5-6_14-56-24.png
    and as you can see their implementation is much more efficient. Is this something that is being worked on? We really like the new flow where unity automatically generates atlases and this is hidden from a user's perspective but issues like this are blockers when you need to squeeze hundreds or even thousands of sprites of different shapes and sizes into the atlases efficiently so you can minimize app size and memory runtime usage.

    The second issue is I noticed the packing of textures into atlas is also not as efficient and even if you have allow rotation enabled it often won't rotate, but if I rotate it manually in photoshop it will manage to squeeze it in atlas without doubling one dimension.

    Also, is there a way to set outline tolerance and generate the outline when sprite is imported to avoid doing it manually on hundreds of assets? upload_2022-5-6_15-7-55.png

    If you need any more info on this I'm more then willing to help since I would really like us to use sprite atlas instead of third party tools mainly because of faster and easier workflow.
     
    JesOb likes this.
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,795
    Just use SpriteUV https://www.spriteuv.com/ I don’t think Unity are capable of making improvements to their sprite tools or they would have.
     
  6. Luka-Maske

    Luka-Maske

    Joined:
    Jul 2, 2015
    Posts:
    13
    For cases like this it would be really cool if we could get access to source, fix it ourselves and do a pull request.
     
  7. Luka-Maske

    Luka-Maske

    Joined:
    Jul 2, 2015
    Posts:
    13
    @rustum Like @AcidArrow linked this is now another third party app which has better mesh generation then unity, why does it seem to be such a problem to improve this?
     
    Last edited: May 17, 2022
  8. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Another problem is that Unity doesn’t have a way to allow rotation of sprites in an imported texture atlas so external programs can’t fix all of Unity’s problems here (not entirely). Unity if you’re not able to update your meshing/atlas solution please let us use external tools that will do this work! Also while I’m wishing into the void for atlas improvement also let us set the texture to use mipmap streaming!
     
  9. Luka-Maske

    Luka-Maske

    Joined:
    Jul 2, 2015
    Posts:
    13
  10. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    How do you preview the sprite atlas v2 atlas in editor?
     
  11. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
  12. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
  13. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    You don't have to do anything once you packed it in the atlas. You just use sprite like normal one on your UI element and Unity will take care that it's from the atlas. If you didn't mean that, then explain better what you want?
     
  14. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I mean to see the sprite sheet in use in editor in the Game view rather than just in the build, unless I'm confusing myself and it is already showing in the Game view.
     
  15. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    165
    You're confusing everybody I think :D

    Again, as I linked in the 1st reply to you, there is a way to see an Atlas in the Editor, not in the Game View but in a separate Window Unity will show. Just follow the instructions from that post's 2nd part.

    Btw, didn't you maybe mean to click on some UI sprite and see to which Atlas it belongs? Not sure, but I think that info is not directly exposed to you...
     
  16. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Once the sprites are in the atlas, I want to see the actual atlased textures in use in the game view wherever the sprites are used. E.g. if I have a few round UI buttons set to 'Tight' packing, when they are used in the UI and another sprite overlaps too much into one of them in the atlas when tightly packed, if I can catch that in the game view and adjust the packing of that round button sprite to 'full rect' so that nothing overlaps the transparent space around it.

    To be completely clear because you keep replying to me about the wrong thing, I know how to see the sprite atlas preview on the atlas. I care more about seeing how the packed sprites behave in the actual game in the editor. When using v1 sprite atlas packer, you used to have the option to only use the sprite atlas sprites in the build or the editor but now that option is gone.
     
  17. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
Thread Status:
Not open for further replies.