0

In Unity5 I use texturepacker and made several spritesheets, but some images in several spritesheets don't work with sprites, whether I created them by dragging the image name under the spritesheet name in project inspector, or manually created an empty game object and adding a sprite renderer then choose a sprite which has problem for it, or even I drag another working sprite to create the game object, then change the sprite to the not working ones, the image in both Scene and Game windows just disappears.

enter image description here

However the not working ones can be uses on UI image component.

BTW if I bring up the "select sprite" window by clicking the little circle behind the sprite bar on a sprite component, all the not working images are not visible. You can see it on the following screenshot: enter image description here

ArtS
  • 1,730
  • 1
  • 20
  • 43
  • 'TextureType' maybe not set to sprite? – Bizhan Jan 03 '17 at 09:20
  • They are set to Sprite(2D and UI). – ArtS Jan 03 '17 at 09:41
  • in unity's sprite editor make sure borders and pivots are correct. also why use external packers when unity has its own sprite packer? – Bizhan Jan 03 '17 at 10:01
  • All borders and pivots are correct. I forgot why I used a 3rd party packer. Maybe because when I created this project in Unity 4, the unity packer had not come out back then? – ArtS Jan 03 '17 at 11:56

1 Answers1

2

First of all unity automatically packs sprites, don't do it yourself, here's what you can do:

  1. Remove the broken sprites from the project
  2. Remove all packed textures you created
  3. Add the sprites again as separate image files
  4. Select all the new sprites, then in the inspector set them to Sprite (2D/UI) and give them all the same packing tag, this will tell unity to pack them into one spritesheet together

another note: UI images will not appear if they're not a child of a canvas.

Unity Docs: Sprite packer

Sprite packing Tag

Mostafa Berg
  • 3,211
  • 22
  • 36
  • Thanks a lot for this info. Is this a new feature in Unity 5? I forgot why I used a 3rd party packer. It's an old project created with Unity 4. – ArtS Jan 03 '17 at 11:51
  • I think it's been there since version 4.5 and above Yeah i guess you needed it at the time, but now it's much better to just use the native tool as it's pretty efficient at what it does, let me know if things worked or not – Mostafa Berg Jan 03 '17 at 12:07
  • Thanks a lot, I'll try it after finishing solving some other problems at hand. – ArtS Jan 03 '17 at 14:56
  • 1
    update: I changed all my 3rd party atlas and use the unity packer, which works great, though still I have to write my own manager that load sprites by name. Thanks again for your help! – ArtS Jan 10 '17 at 07:06
  • Perfect, let me know if you need any help with that, or simply post a new question and link it here if you have further issues, glad to help:) – Mostafa Berg Jan 10 '17 at 07:46
  • Thanks. I just wrote a manager so that in the editor you drag all the sprites into a list of sprites, then in Awake index them into a public dictionary with keys of the sprites names. Then you can get a sprite by name anywhere in the game :) – ArtS Jan 12 '17 at 01:37