Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

PSD Importer tool + Sprite atlas

Discussion in '2D' started by Tarodev, Mar 10, 2019.

  1. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    181
    I've been using sprite atlas to great effect, keeping my draw calls to a minimum, but I can't seem to find a way to add my characters which I imported using the PSD importer tool to an atlas.

    The result is when lots are on the screen I have upwards of 450+ draw calls as each limb must be it's own call and gives horrid performance on mobile.

    Surely there's a way to do it, right?
     
  2. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    595
    Please try adding the sprites individually to the SpriteAtlas Packable Objects.
    Also if you are referring to this package : com.unity.2d.psdimporter@1.0 you should be able to add the texture object or the folder that contains the psd texture to the Sprite Atlas packables. Please use the latest version of 2019.1 Beta
    (Unity 2019.1.0b6) Let us know if this works.
     
  3. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    181
    Trying now, but the PSD Importer does not actually work with 2019.1.0b6.

    Reproduce:
    Create fresh 2019.1.0b6 project
    Import com.unity.2d.psdimporter@1.0 from package manager
     
    Last edited: Mar 10, 2019
  4. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    181
    In a new project using 2018.3.5f1, it batches it all together, but in my main project in the same unity version it doesn't... I'm trying to find the delta, but the only thing I can think of is that the main project is rigged with bones and the unity 2d IK. Would that do it?
     
  5. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    595
    In 2018.3 versions animated sprites are not batched. However we have added support for batching of animated sprites (SpriteSkin) in 2019.1 (please test latest beta).
    More info here :
    https://forum.unity.com/threads/2d-animation-v2-preview-packages.599356/

    Will take a look asap.
     
    Lars-Steenhoff likes this.
  6. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    415
    Hi, the PSD Importer should work with 2019.1. What error are you getting?
     
  7. Tarodev

    Tarodev

    Joined:
    Jul 30, 2015
    Posts:
    181
    I'm an idiot. It just required 2d.animation.

    I'm suffering a new problem now.. The PSD imports work with their rigs, but my actual prefabs have lost all linking to their bones, see the video below:

    https://www.dropbox.com/s/ga7gjaaiupi1j2f/Z87Iy6puaw.mp4?dl=0
     
    Last edited: Mar 11, 2019
  8. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    54
    @Tarodev:
    Did you figure out a way to put Sprites from a PSD into a Sprite Atlas so that draw calls for the sprites are batched?
    I put them into the sprite atlas directly (not through a directory), but there are still a lot of draw calls...

    BTW: Great videos on your Youtube channel!
     
    RemDust likes this.
  9. magnetic_scho

    magnetic_scho

    Joined:
    Feb 2, 2020
    Posts:
    54
    I finally figured this out. Sprite atlases work with 2D Animation as expected!

    The issue in my case was, that I highlighted some instances by changing shader properties, which resulted in every sprite getting its own material. Since batching only works with shared materials, I had to reset the materials back to the original one, after highlighting was over.

    Using the FrameDebugger was really helpful btw!
     
    RemDust likes this.