How to import Sprite Sheet with original Framesize

Hi,

like the most Users of this Forum I am realy new to Unity (but not to C#).
My Question is about “importing Sprite Sheet” to Unity. In short time I have managed it to import a PLIST-File with corresponding PNG an parse/slice them to separate Sprites.

My TexturePacking tool trims the Images to save space/size of the resulting Sprite Sheet Texture. But in the PLIST File it stores the original Framesize. (see illustration below)

2989000--222443--UnitySpriteImporting.png

In Unity all Sprites have the trimmed Rect Size.
My Question is how do I manage it to create Sprites in original Size?

It would be nice to solve this Problem in the Editor (in a AssetPostprocessor) and not while Runtime with changing the Texture of the Sprite/GameObject!

EDIT:
What I did so far:

  1. Parse PLIST Data into a Array of SpriteMetaData named SpriteDataArray.
  2. Set MyImporter.spritesheet = SpriteDataArray.
  3. Import Sprites with AssetDatabase.ImportAsset(MyImporter.assetPath).
  4. The used Texture Rect for each Sprite is the trimmed Rect Size because of… (see pic below)
    2989000--222464--UnitySpriteSheet2.png
    I need some technic to to put the trimmed Sprite Texture into a Sprite with the original Frame Size of the Sprite Sheet Texture frame.

Thanks for any hints or Help!

Did you try editing your sprite in Unity and selecting Mesh Type “Full Rect” instead of “Tight” ?

Hi Furroy,

I never tried the Mesh Type Option before… but isn’t it just for Rendering performance optimisation?

How can I change Sprites of a Texture and save the Result permanently in the Editor?
What I would like to try is:

Iterate throuh all Sprites of the Texture in the
OnPostprocessSprites (Texture2D texture, Sprite[ ] spritees) Method of AssetPostprocessor.
replace the Sprites with new Sprites (original Size).
I mean I would also like to try to create new Mesh Rect with the needed Size… but don’t know how to save the Sprites after resizing them.

Example: (see pic below)
1. iterate sprites of mmexp
2. take “mmexp_0” texture.
3. create new Sprite with texture of mmexp_0 and the original rect size
4. replace mmexp_0 with the new Sprite created in step 3.
5. Save edited Sprites inside the Texture and make Unity Editor regonize the Changes.


This Sprite Sheet Example is not my work. I just downloaded the first hit on google for Showcase purpose. Arts downloaded from swingswingsubmarine.com