I am slicing a 300x270 spritesheet into 30x30 grid slices to produce sprites like the following:
I’m noticing that in the Sprite Editor that it’s not slicing them pixel perfect and it’s including a little bit of an artifact on the bottom of the above sprite for example (his two feet):
When I then include this in my scene I see the artifact like this in game (see above his head? that’s his feet from the sprite above):
I should mention the settings I’m using for the spritesheet before I slice them:
Texture Type: Sprite (2D and UI) Sprite Mode: Multiple Pixels Per Unit: 16 Generate Mip Maps: True Filter Mode: Point Max Size: 512 (my spritesheet is 300x270) Format: Truecolor
Am I slicing these images correctly or is there something I’m doing wrong?
You are also probably using Filter Mode: Bilinear/Trilinear. Bilinear/trilinear filtering smooths the images. Try changing this to Point.
If this doesn’t work:
You should add at least 1 pixel between edges of your Image. So, move your character so that there’s at least 1 pixel between legs and lower bound of the slice.
I have so many spritesheets that moving them all to have 1 pixel between edges is ridiculously time consuming. Is that seriously the only way possible? Seems like a bug in Unity.
I also mentioned all the settings I’ve used for my spritesheets and Filter Mode: Point was one of them.
You could try adding an offset value when grid slicing your sprite sheet in the Sprite Editor to ensure that your sprites are captured correctly in your sliced cells. You can verify that by zooming in in the Sprite Editor to see if the pixels belong to the right cells.
Alternatively, you can make use of the Sprite Packer by adding a SpritePackingTag to your textures. This will add an edge padding to your packed sprites.
I had this issue and fixed it by slightly raising the sprite’s position on the y-axis. I think it was something to do with how I placed the sprite in the scene on the ground collider. Maybe they were overlapping and causing issues.