In the project, I configure multiple scenes and save the data: objects on the scene, lightmaps and other.
When the scene starts, I load saved lightmaps. Also, because I load objects dynamically, I define the lightmap(s) for each object that has a rendered:
// Load lightmaps
LightmapData[] lightmaps = new LightmapData[missionLightData.lightmapsNumber];
for (int i = 0; i < missionLightData.lightmapsNumber; i++) {
lightmaps *= new LightmapData*
{
lightmapFar = Resources.Load(GetLightmapPath(missionName, i))
};
}
LightmapSettings.lightmaps = lightmaps;
// Define lightmaps for the objects
foreach (MissionLightmapData.LightmapAssotiation lightAssotiation in missionLightData.lightmapAssotiations) {
GameObject go = GameObject.Find(lightAssotiation.objectName);
if (go)
{
Renderer renderer = go.GetComponent();
if (renderer)
{
renderer.lightmapIndex = lightAssotiation.lightmapIndex;
renderer.lightmapScaleOffset = lightAssotiation.lighmapScaleOffset;
}
}
}
It worked fine in Unity 5.3. But after upgrade to 5.4, the mission looks black&white.
[75509-blackwhite-scene.jpg|75509]*
I also noticed that if I don’t touch the scene, everything loads fine in the editor. But as soon as I modify the scene (some other settings are updated by Unity) or if I run the scene, I get same “black&white” effect.
Any ideas what can cause such effect? Maybe Unity stores lightmap associations to the objects somewhere else now?
*