Manually applied lightmaps not working in build since upgrading to Alpha

Hello,

Our game at runtime gets a lightmap texture array from a prefab, add them to the scene LightmapSettings, and assign the updated lightmapIndex to the renderers.

// Update scene available lightmaps
LightmapSettings.lightmaps = newLightmapArray;

// (Inside a loop) Assign index to renderer
info.renderer.lightmapIndex = lightmapOffsetIndex[info.lightmapIndex];

We initially had a problem with it due to Unity stripping unused UV channels (“Optimize Mesh Data” options under the “Player” settings), but it is not the case anymore.

This has been working fine in the 2019.3 version, both in editor and build.
Since updating to the alpha version, this works only in the editor windows, and does not work in build.

I added logging and can confirm that both the textures and the meshes are the same as when in the editor.
I tried disabling texture mipmaps and texture streaming, with no effect.

I read from the release notes that a lot of work has been done in global illumination, maybe there are some additional steps we must do to apply the new lightmaps at runtime?

Thank you

I ran into a similar problem, I believe it was fixed after passing an empty texture to lightmapDir.

I had this issue in a 2019 version of Unity, if I’m remembering correctly. The solution was to go into Project Settings → Graphics and set “Lightmap Modes” to “Custom” with all boxes ticked.

2 Likes

That was it!
It was set to “Automatic” and I think Unity 2020 checks differently what kind of lightmap you use in your project.

Thank you.