- Home /
Corrupted sprites in builds ONLY
We started having this really strange issue out of the blue. Some sprites get corrupted but only in (Windows) builds. There are no problems when the game is run from the editor.
Here's how the corrupted sprites look in the build. The one on the left works correctly, the one on the right is all messed up.
It is a really puzzling problem and we have never encountered anything similar on this project for the last year. Furthermore this corruption issue started appearing on sprites that were fine just weeks ago. We tried every single solution we could think of. Our conclusions are these:
It's not a problem with the file itself. We tried deleting, copying, recreating from the source and nothing helps. The file is read correctly in the Editor and in every single software application as well.
It's not a problem with the import settings. Both of the icons in the picture above have the same settings and are identical in terms of size, file format, etc.
It's not related to the way the sprite is presented - the issue occurs both in regular Sprite Renderers and UI Image elements and is also presented when already present in the scene and when instantiated.
It doesn't seem to be hardware related. We tried building and running on various hw configurations including laptops. We tested on both dedicated GPUs (nVidias) and intergated Intel cards. We also tried updating drivers - no difference. All computers were running Windows 10 though.
The corrupted sprites really seem to have nothing in common in terms of their properties. The issue manifests on both transparent and opaque sprites, of various sizes and colour palettes.
Deleting the 'Library' folder and reimporting assets does not help. We tried this solution on two different computers.
The corrupted sprites work correctly when the scene that presents them is the first scene in the build order - this is utterly confusing. If the scene is loaded directly after the application runs everything is fine. If it's loaded into from the other scene however, it's broken.
We are on Unity 5.3 and it might be a problem related to this, however there is nothing like this in the Issue Tracker. We also couldn't find anything similar while searching through the internet forums. We tried building on 5.3.1 up to the recent 5.3.5 - no difference.
Any assistance would be GREATLY appreciated.
Any news on a solution? We have a very similar one here as well!
Answer by drHogan · Mar 12, 2017 at 03:19 PM
Ok, I had the same identical problem, and today after a huge twisted search I solved it. I hope you @barjed did too, but others might find this answer useful. The problem was that the resource folder was, when packed, above 4Gb and that drives Unity nuts on textures. Reduce that size by removing stuff from the resources (in our case we had our textures outside, but the damn prefabs using them inside), and the problem for us disappeared.
I get that the removal of the textures would stop the error but i need to use the prefabs and the animations connected to it. Thats why they are in my scene. How would I find a work around without having to delete things?
Answer by boehmz1990 · Feb 08, 2017 at 02:47 PM
For me this problem was solved by turning off mip-maps in all sprites.
shout out to http://answers.unity3d.com/questions/1196020/sprites-appears-corrupted-in-standalone-build-but.html for the suggestion
Answer by Zullar · Mar 14, 2019 at 11:50 PM
I am also having an identical bug. https://forum.unity.com/threads/unity-ui-sprite-getting-scrambled.643435/#post-4321717