- Home /
White Edges on Sprites Loaded from PNG at Run-time
When I use use Texture2D.LoadImage at run-time to create a sprite from PNG I get white edges around my sprites that I don't see if I import the same exact sprites in the Editor. I assume this has to do with pre-multiply alpha and I know there are ways to pre-process the source image to avoid this, but this is a tool for non-technical end users to select their own images, and I want to keep this simple and user-friendly for those users.
I have read a few other threads and unity answers posts regarding this issue, but the only solution I am seeing is source image pre-processing which as mentioned above is not really an option.I have tried messing with the alphaIsTransparency settings on the runtime texture to no avail.
Is this issue some kind of limitation of run-time texture/sprite loading or is there a workaround or setting I am missing? The editor handles these files perfectly, so I know Unity is at least capable of doing what I want on some level.
Thanks for any help! (Unity 5.6.1f1)
Other similar issues:
http://answers.unity3d.com/questions/52623/pixel-wide-border-artifact-on-texture-loaded-from.html
http://answers.unity3d.com/questions/1237452/sprite-black-borders-on-imported-transparent-png-f.html
http://answers.unity3d.com/questions/10302/messy-alpha-problem-white-around-edges.html