- Home /
Sprite Shape not working (need help/suggestions!)
I'm working on a 2D platformer and have already built a bunch of tile-based levels, but now I want to leverage Sprite Shape to get more organic/curvy landscapes for "special" areas.
The problem is, I seem to have encountered a major bug with Sprite Shape in that won't allow me to use any of the sprites in my current sprite sheet.
I've already:
Created a Sprite Shape profile and assigned it one of the "terrain" sprites from my sheet
Created an "Open Sprite Shape" game object and assigned it the profile in step #1
Everything looks fine and dandy in the editor--the Sprite Shape appears as it should and I'm able to edit the spline without any issues--but as soon as I launch the game the Sprite Shape goes invisible and I'm greeted with this nasty little error message in the console:
ArgumentException: tileset-1-separated_1 is packed with Tight packing or mesh type set to Tight. Please check input sprites
Seems simple, right? Based on that error message all I have to do is change my sprite sheet's packing mode to Full Rect instead of Tight.
... except I already have changed it from Tight to Full Rect, and the problem still hasn't been resolved.
But wait, it gets stranger: Just for kicks I decided to import an EXACT COPY of the sprite sheet I'm using and chose Full Rect as the default import setting instead of Tight. I gave it the exact same settings as the original sheet I'd already been using, tried assigning one of its sprites to the Sprite Shape profile I created above, and... it worked! No error message, nothing. The Sprite Shape was there when I clicked play.
How is it possible that one sprite sheet works with Sprite Shape and one doesn't, when they're literally the exact same image/PNG file and I've cross-referenced them to ensure that they share the exact same settings? The only difference between the two is that the original was set to Tight when I first imported it, whereas I made sure to set the copy to Full Rect right off the bat.
Is it possible that if you choose Tight first (rather than Full Rect), then that setting somehow remains in place "behind the scenes" even if you later switch over to Full Rect? Because clearly, Sprite Shape seems to think that the original is still set to Tight when it is in fact NOT. Or is something else going on here?
Here are the settings for my original sprite sheet: https://i.imgur.com/NP2jZf3.png
And these are the settings for the exact copy: https://i.imgur.com/EJCevbf.png
Do you see any difference between the two? Because I sure don't--but apparently Sprite Shape does!
I would love to hear if anyone else has encountered this before, and if there's some sort of fix. Since the exact copy works I understand that I could just switch over to it and ditch the original, but also understand that that would result in a whole lot of extra work since I've already used loads of sprites from the original sheet. It'd be fantastic if I could somehow resolve this so that I could just continue using my original sheet.
Ok, this is definitely a bug. I just did another test where I duplicated the original sprite sheet (inside of Unity) and now the duplicate works with Sprite Shape, but the original still doesn't. Somehow the original's "Tight" setting has been permanently recorded behind the scenes, and the only way to have it recognized as "Full Rect" is to either duplicate it (which I'm assu$$anonymous$$g creates a new behind-the-scenes profile that isn't incorrectly labeled "Tight") or import the exact same PNG image and make sure I select "Full Rect" from the start.
If anyone knows of a "fix" for this so that I can still use my original version (to maintain all of the original references), I would really appreciate it!
Answer by Chubzdoomer · Sep 02, 2021 at 12:31 AM
If anyone else ever encounters this problem, I finally figured out what was happening:
At some point in the past I had created a Sprite Atlas containing a reference to my tilesheet. I did this back when my tilesheet's Mesh Type was set to "Tight" rather than "Full Rect." Although I never actually used the Sprite Atlas (it was merely sitting there with the rest of my assets), that is what was causing the problem!
As soon as I deleted the Sprite Atlas asset, my original tilesheet finally became compatible with Sprite Shape and was no longer incorrectly seen as having a "Tight" mesh type. For whatever reason, the Sprite Atlas file is what Sprite Shape was looking at... even though I hadn't even been using it in any of my levels!
Short version: Sprite Atlas was the culprit. If you have a Sprite Atlas asset referencing your tilesheet, delete it if you aren't using it. If you are using Sprite Atlas, deleting the asset file and re-creating it may solve the problem (I can't verify this myself).
Answer by Eno-Khaon · Aug 29, 2021 at 04:01 AM
Well, Unity *DOES* record data "behind the scenes" for you, through metadata files. A simple (-enough) way you can try testing this:
1) Right-click the sprite sheet file and select "Show in Explorer".
2) Close the Editor once you have the folder open.
3) Find a file with the same name, but a ".meta" extension.
4) Delete that metadata file. (I'd say make a backup of that file to another location just in case, as well)
5) Re-open Unity.
There will be settings that need to be rebuilt at this point for that specific file, but this should give you a blank slate without any unexpected or potentially erroneous data to start from.
Edit: You could also just try editing the metadata file. They're human-readable.
First of all, thank you for the response!
Unfortunately even after deleting the metadata file and re-opening Unity, the problem still persists (and oddly enough, if I duplicate it the duplicate still works).
It would seem there's something besides the metadata file that's being stored behind-the-scenes, but I don't know what that could possibly be. If you have any other ideas I'd love to hear them.
I guess at this point the worst case scenario is that I'd have to make a duplicate, modify all my objects to reference it, and then just delete the original. That would of course be very tedious though since it'd involve modifying 100+ objects to reference the duplicate instead of the original, so I'd love to avoid that scenario if possible!
Looking back at your pair of images, then, the only "invisible" difference to speak of between them could be the potential differences if you open the Sprite Editor for them. I won't claim to know *why* you're experiencing the problem you are, but if something was inexplicably baked into the way the sprites are divided up there, maybe that could be a holdover at this point?
Your answer
Follow this Question
Related Questions
2D Box Collider / Sprite change direction issue 1 Answer
Sprite editor window not registered, but I've done every solution I found. 0 Answers
Fast Sprites Extraction from Sprite Sheet 0 Answers
2D walking over/under objects 2 Answers
2D sprite broken 0 Answers