On build, Lightmap UV is broken on specific scene / prefab when using unlit (support lightmap)

Hello.
When I build lightmap, it looks ok in editor. However, when I build it, it looks very bad. It seems like uv is broken. The weird thing is that when I build specific prefab, it goes wrong. Other objects looks normal both in editor and build. What could be the possible reason?
I used Bakery to build my lightmap, but I think this is not a problem. other scenes/prefabs have no problem using Bakery. I tried Unity’s progressive Lightmapping, but the problem was not fixed.
I also checked Genereate UV options.
I uses my custom shader based on Mobile/Unlit (Support lightmap). But I tested on Unity’s unlit shader. It also shows problem.

This is from editor

This is from the build


Any helps are appreciated.

I digged for few days, I got answer for my case.
Try to disable Project Settings → Player → Other Settings → Optimize Mesh Data.
If this is checked, it blow your second uv sometimes.

If you do not want to disable this option, try to change order of uvs in Shader (texcoord0, texcoord1 …). It worked for me, but I need to check why it does.

2 Likes