Our game has been randomly garbling textures on standalone builds, but not during play-in-editor. We've seen this affect TextMeshPro fonts, GAF-based character sprites in our overworld, and Unity UI images. Seemingly any texture is susceptible to it.
The repro for this is really odd. If I make a build starting at our main menu and transition into the game world from there, lots of things get garbled, text included. If I rearrange the scenes so that the player starts directly inside that first scene, nothing gets garbled. When we repro it by transitioning in from the main menu, the same objects/textures will always be garbled in the same way. We have found more than one way to reproduce this bug, but it's most severe when we come out of our main menu.
We do not know how what gets garbled and what doesn't get garbled is determined, but we have found that changing the font asset for our text does have a chance to work in not garbling the text. I say a chance because some fonts will garble, and some fonts won't. Deleting and re-making the fonts that get garbled does not fix the garbling.
Things that we’ve checked:
- No errors occur in the console. There are no null refs, there are no missing reference exceptions, nothing indicates where or what might be failing.
- We aren't hitting the 4 GB texture limit yet. As it sits we only have 2 GB total in the Assets folder, and only about 0.56 GB of that is textures.
- We aren't using Resources to load in anything. All our characters are pre-placed. GAF does make use of a lot of resources folders itself, in a way that is black-boxed off and untouchable, but our text and our UI definitely do not.
- We have not yet tried separating assets into Asset Packages. It's during the process of looking into them that we found out how little space our assets were actually taking up.
- We've disabled every instance of async scene loading in favor of traditional loading.
- We aren't using the legacy sprite packer.
- The garbling happens on DirectX and OpenGL alike.
- The garbling is not dependent on hardware -- everybody's computer produces the same effect in the same places.
- Our texture memory load hovers consistently at around 1.4 GB from scene to scene, and this accounts for the majority of our memory use. It doesn't seem to grow with subsequent scene loads, and it shrinks accordingly when we hit scenes with lower counts of characters or less complex environments.
- No serious processing problems are indicated in the profiler, and performance is otherwise really, really smooth. The game is, apart from this texture problem, playable.
- Using quality settings to reduce texture sizes universally by half does not change anything, including the texture memory usage.
- Deleting large amounts of assets reduces the chance of textures getting garbled in the build.
- Deleting and re-creating assets on an individual level does not fix or change the issue, whether it's one texture or the entire asset wrapped around it.
- Migrating to a newer version of Unity does not fix the issue; this problem crops up just as easily on 2019 builds as it does on 2017 builds.
The more we investigate this, the more mysterious the issue seems to get and the less certain we feel about the nature of it. It presents almost consistently with the garbled textures from exceeding 4 GB of texture resources, but again, we haven't even got 4 GB of assets in the first place. Nothing else graphics-related seems to affect this issue.
So! Anybody encounter something similar to this? I'm going to keep trying things, but if anybody's worked on a game with a sizeable number of 2D assets and feels like they've seen this before, I'd very much appreciate help or suggestions!