Randomly missing materials in production builds

So this is a problem that’s been bugging us for while and which appears to happen at random.

Some materials appear to be missing in production builds or all of the UV coordinates are just offset to a very small space in their UV map which makes the material look as if sampled from the same texel. The faulty UVs is just a theory however but sounds reasonable to me since the materials color looks very uniform (green, brown or whatever).

Our not so great workaround so far have been to just hide the model with the problem from view and use a duplicate of it instead (which looks fine for some reason, same mesh, same material).

Note1: We have to keep the model with the issue in the scene or the problem will just seemingly “transfer” to the second one.
Note2: This only happens in production builds, we are using texture and mesh compression at their default settings.
Note3: A model that have looked fine for several production builds might just get “infected” by this issue at any new production build.
Note4: So far have only been an issue with materials with color maps.


Original Post on Discord

by user 427134081860501507

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

Hi, how is this material used in unity (multiple objects?, what kind of renderer / multimaterial?) Does it reproduce with just a part of the scene?

It definitely sounds like a post processing bug. If you could send a minimal repro (as minimal as you can get) with some info which material usually breaks it would be great

It does not repro with an isolated selection I’m afraid. The model that has the issue now contains three submeshes with 2 different materials (MeshRenderer). Another model manifests a similar problem and that one is one skinnedMeshRenderer (one material).

by user 427134081860501507

If you can still submit the full project as a bug report with clear repro steps that would be helpful!

Yeah, that would break our NDA so that’s not really an option. I will make a bug report if I find a minimal case that repros.

by user 427134081860501507

(if you provide us with your license details we can also countersign an NDA if needed)

I made a scene with a bunch of models that have been problematic for us. It’s been uploaded as a bug report.

  • The group of sitting NPCs do not have the right material. Each is loaded from a prefab and will have their material assigned if specified from script.
  • The unfolded cubes have six materials each, can not see any problems there. Made these recently as a test but seems to work.
  • The background mountain billboards (looks ok recent in build) In another scene (cannot share) it just looks like a black blob.

by user 427134081860501507

Hi @Snorulf how/where can I see the sititng NPCs? I just started the project

There is a cluster of them 3m away from origo. Enable gizmos in editor window

by user 427134081860501507

by user 427134081860501507

Thank you

@Snorulf just to be sure I’m understanding the problem correctly. The first image is the character with the correct texture and the second image is after compression (missing textures) - is that what you’re seeing too?

Yes, correct

by user 427134081860501507

Ok good, thanks

so the good news is: it reproduces with just those two chars in the scene.

so far i was able to reduce it down to just having LiamA in the scene (nothing else) and when I apply draco compression it doesnt have any colors anymore. I’ll investigate further - it might be a third party issue (not 100% sure yet). Will keep you posted

Hi, it seems to be indeed a thirdparty issue. I opened a bugreport after reproducing it with their latest version (just the one character was enough)

Another update: it seems to be related to wild uvs on that model. See the screenshot below with the long tail to the right. I think fixing the uvs should fix compression for this model.