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

Possible to use slicing with sprites imported from TexturePacker?

Discussion in 'UGUI & TextMesh Pro' started by andymads, Jan 22, 2015.

  1. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Does anyone know if it's possible to use slicing with sprites imported from TexturePacker via the importer?
     
  2. FuguFirecracker

    FuguFirecracker

    Joined:
    Sep 20, 2011
    Posts:
    419
    If you check the comments on the Asset Store page https://www.assetstore.unity3d.com/en/#!/content/16641
    There are a couple of solutions listed for maintaining the slicing. You may have to click the "show all reviews" link to see said reviews.

    I, however, could not get either solution to work. Maybe I didn't look at it close enough.

    Cumbersome workaround is to simply delete the the .tpsheet file after importing your sprites before you set your 9Slices in the sprite editor.

    That was quicker for me than futzin' about with the code and making a new package and all... But if you have many 9Slice sprites and Republish your sprite sheet frequently... get one of those hacks working and saved out to a new asset.
     
  3. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    I've just been playing around and somehow got the borders for one sprite in an atlas to actually save, but I can't repeat for any other sprites in the atlas.

    EDIT:

    Well now I seem to be able to edit lots of them.
     
    Last edited: Jan 22, 2015
  4. JackAidley

    JackAidley

    Joined:
    Aug 31, 2020
    Posts:
    8
    Very old thread I know, but since it comes up as one of the top hits for "unity texturepacker 9-slice", I thought it was worth leaving an updated answer for those searching in future. TexturePacker now supports 9-slicing directly in the editor and export process (it calls it "9-patch" instead).

    To use it, select the image you want to 9-slice in the TexturePacker GUI, click "Sprite Settings" in the toolbar at the top, enable the "Enable 9-patch scaling" tickbox. Then, when you publish the sprite sheet again, it will work automatically if you choose the sprite in Unity.