Sprites missing textures in addressables builds

Multiple of my sprite textures are missing in both editor and standalone players when using addressables. The sprites load succesfully, but their textures are empty/blank/transparent.

This is affecting sprites using in SpriteRenderers and UI Images. From debugging, I can see that the sprite loads successfully, but the texture is invalid. The textures aren’t null, but have a width and height of zero, and calls to any methods on the texture throw invalid texture errors.

The strangest thing is there doesn’t appear to be any consistency to when or how this issues occur. I have one addressable scene with 3 sprites as implicit dependencies, all are rendered in a UI Image component. 2/3 of them fail to load, but one loads fine. I tried duplicating the one that loads fine and assigning the duplicate to a UI image, and then it fails to load in the same way.

When inspecting the addressables build report, I can see that the sprites bundle size is incredibly low, especially for the size of the texture. The sprites in question are background art for UI menus, so are big enough for 4k screens.

I’ve attempted defining the textures as explicit addressable assets, changing platform texture settings, and moving or renaming them to no avail. Loading them explicitly via an AssetReferenceSprite also makes no difference.

Screenshot shows the addressable report. As shown, “Splash Eye.png” is 8mb, but “Splash Eye 1.png”, which is a duplicate of the same texture, is only 71.21kb

None of these textures use a SpriteAtlas. There are no texture packing tags. They do not have secondary textures.

I’m using 2022.3.17f1 LTS, and I’ve tried using Addressables 1.21.19 and 1.21.15, and I’ve tried with ScriptableBuildPipeline 1.21.21 and 1.21.9. I have had to use a modified version of 1.21.21 to bypass the current build time regression on scenes containing sprites. I’ve attempted cleaning cache, and manually deleting previous build artefacts and running a clean build. The issue persists.

Could I possibly have something misconfigured, or is this a bug? Are there any known issues this could be related to, or will I need to attempt to produce a sample project to replicate the issue?


edit: after trialling some different scene configurations, now I can’t get any of the sprite’s textures to be included in the bundle. Fun!

I rolled my project back to 2021.3.18f1 LTS with Addressables 1.19.19 and the issue did not occur. I then tried upgrading the Addressables to 1.21.19 and the problem still did not occur. (I also did not encounter the egregiously slow build times, despite using ScriptableBuildPipeline 1.21.21). It was slower (at around 4 minutes) but no where near the 2-6 hours I experienced in 2022.

Looks like there’s something in 2022 causing this issue.

I’ve attempted to reproduce the issue in a sample project, but have been unable, even when using the same assets and settings.

However, the process did unveil some fun quirks to this bug. I attempted mirroring the settings of the sample project back to my bugged project. Changing certain build settings on the addressable asset settings object resulted in changes to the bug. I disabled MonoScript Bundle Build, and this caused some of the sprites to load their textures, while some remained broken. I’m not sure if this really explains anything, other than showing that this bug is particularly inconsistent.

Toggling the Monoscript Bundle Naming Prefix setting does consistently change which sprites are included in the final build, but no settings fixes the issue entirely.

Examples of the different results below - note that various textures are changing size, but in both scenarios some textures are too small to contain anything but sprites and headers.


While trying to reproduce the bug for a test case, I think I’ve tracked down the cause.

I copied my entire assets folder into a fresh 2D project, and the issue didn’t occur. I then compared each different setting, and re-tested the build after porting the fresh settings into the old project.

The issue was in the ProjectSettings/ProjectSettings.asset: When PlayerSettings.stripUnusedMeshComponents is enabled (StripUnusedMeshComponents: 1) and PlayerSettings.colorSpace is set to Gamma (m_ActiveColorSpace: 0), some sprites will be missing their textures in the asset bundles. Not sure of the why, but that’s the how.

Sadly, I’ve still been unable to replicate the issue when using a stripped-down project. So I suppose we can call this one resolved/unreproducible for now.

I think either I have gone mad, or Unity 2022 is haunted.

I meet the problem same as SudoCat.
All materials of 3D meshRender has no texture(_MainTex) input.
And all 2D spritesRender have no such problem.
UnityVersion: 2022.3.17f1c1
PlayerSettings.stripUnusedMeshComponents is enabled and PlayerSettings.colorSpace is Gamma.
I have tried uncheck it or set colorSpace to linear, but bug still exist.

Sorry I never updated this thread.

This issue was resolved in Unity 2022.3.21f1 - Please update to get the fix.

https://issuetracker.unity3d.com/issues/returned-texture-is-grey-when-using-a-custom-lit-2d-shadergraph-and-the-2d-light-texture-node-for-tilemap-renderers