1
\$\begingroup\$

First of all let me start with an apology. I know this may not be the right place for this question, but the good people over at stackoverflow did not answer me and neither did I get a answer over at Unity Answers, so I'm hoping that someone here will know. So without further ado here is my problem.

I'm writing my own asset importer and would like to automatically slice the sprite sheet.Slicing it with a grid is not viable since we have sprites with different sizes and I need to use the automatic slice option form the Sprite Editor. So far if the imported file has "sheet" in the name I can set all the properties I want. All that is left is do the automatic slicing but I cant even find anything in the documentation. Is this even possible ?

Edit: here is a screen shot. I want to access this functionality from my custom EDITOR script. enter image description here

In simples words I want to click this button from a script instead of the artist when he imports a new spritesheet.

\$\endgroup\$
  • \$\begingroup\$ Are you looking for something like this?: assetstore.unity3d.com/en/#!/content/12911 \$\endgroup\$ – S. Tarık Çetin Apr 8 '16 at 10:06
  • \$\begingroup\$ @S.TarıkÇetin No, I dont want to dynamically slice sprites in the game. I can do that myself. What want is to use the Sprite Editor that you use to slice sprite sheets from a editor script. \$\endgroup\$ – Uri Popov Apr 8 '16 at 11:07
0
\$\begingroup\$

Alright I know this post is old, but I guess that if someone else bump into it, like I did, they might actually want an answer.

I found that guy called Shadesbelow made an editor script that slices your sprites.

Edit to your own need: https://gist.github.com/shadesbelow/8a6ddc54db795241f3cff539db6ea487

\$\endgroup\$
  • \$\begingroup\$ Link only answers need information in the answer itself, because if the link dies, so does the answer. \$\endgroup\$ – Evorlor Aug 27 '18 at 15:21
2
\$\begingroup\$

Actually I don't think that's possible.

Sprite Editor is just a tool to help prepare your spritesheet before you can actually "use" it in your game.

\$\endgroup\$
  • \$\begingroup\$ I dont want to use it in my game, I want to use it in a editor script to help improve the artists workflow. \$\endgroup\$ – Uri Popov Apr 8 '16 at 8:00
0
\$\begingroup\$

There's a free plugin that can semi-automatically slice sprite sheets: https://assetstore.unity.com/packages/tools/sprite-management/texturepacker-importer-16641

The advantage is that it can work with tightly packed sprite sheets (polygons in stead of rectangles) and trimmed sprites (sprites that have obsolete transparency removed, re-aligned by using pivot points).

The plugin requires a sprite sheet description file with names and locations of the sprites. The sprite sheet with the file can easily be created with a tool called TexturePacker.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.