I have this sprite here which is part of a character. As you probably can see, it has a white area in the lower middle, which is semi-transparent.
But when placed into a sprite renderer in the scene it suddenly shows this white line where the black contour and the white area meet:
In the import settings, "Alpha is transparent" is checked. I tried messing with the texture MaxSize, and it made the line thinner but didn't get rid of it. The sprite renderer has material Sprite-Unlit-Default, I also tried Sprite-Default.
How do I get rid of this?
I am using Unity 2019.4.35f1 LTS and URP. The image was created with ClipStudio and exported as PNG to import in Unity. This is the only image with that issue. We have tried re-exporting but no dice.
I have found this related issue: Incorrect white matte behind antialiasing on imported sprites but the solution seems not applicable to my problem.
Thank you!
I took a look at the texture in Unity:
The actual issue with white pixels can be fixed by using "Point" as "Filter mode" instead of "Bilinear".
If you want to use "Bilinear" filter mode, you can also scale up the image by 200% to 420x290 pixels in Photoshop (or similar).
You are having this problem, because with bilinear filtering, the GPU is mixing the between the pixels A (black and opaque) with B (white and almost transparent) to new unwanted color (light gray - half-transparent).
UPDATE 1:
You can also configure the Sprite to have the MeshType "Tight" and place the sprite into an SpriteAtlas, then SpriteAtlas Texture size will be 256x256 pixels and Unity will keep the relative position.