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. Dismiss Notice

Question Aseprite Importer - Keep sprite size

Discussion in 'Editor & General Support' started by Raposah, Aug 7, 2023.

  1. Raposah

    Raposah

    Joined:
    Jun 3, 2017
    Posts:
    4
    When trying to import a sprite, it removes slices it so only the visible pixels are left (trims out transparent pixels).
    So in this sample
    upload_2023-8-7_18-42-19.png
    (32px by 6px)
    The sprites gets trimmed
    upload_2023-8-7_18-42-58.png

    This sprite is part of another sprite, so positioning must remain constant. Is there any way to do it?
     

    Attached Files:

  2. Raposah

    Raposah

    Joined:
    Jun 3, 2017
    Posts:
    4
    Also, the sprites are imported with a margin/padding (aditional size) that is affected by shaders:
    upload_2023-8-7_21-16-16.png
    The top sprite is a PNG export from aseprite, the bottom one is using the imported .aseprite file. They share the same shader, a simple "step fade" shader that hides part of the sprite based on a range slider (0 meaning full hidden and 1 to fully shown).
    The current value is 0.33. As you can see, the top sprite is correctly calculating the fade effect, but the botton one is nearly full!
     
  3. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    875
    Yes, this is done by Aseprite. The data stored in the .ase/.aseprite file is a cropped version of what you see in the editor.

    Making use of Pivot Space: Canvas should help you position the sprite in accordance to another Sprite placed on similarly sized canvases. Have you tried this?

    Yes, you can get around this by setting Import Mode to Sprite Sheet. This import mode gives you a sprite sheet, without any automated slicing done by the importer, meaning that you can set the size of each Sprite. Note that you have to define the pivot by yourself when using the Sprite Sheet Import Mode.

    In a future version of Aseprite Importer, we are adding an option to remove all margins and paddings, but I don't have any dates on when this version will make it out to the public yet.

    Let me know if you have any questions!