- Home /
Baked lightmaps broken in mobile
I am making a game with different levels. Each level is an additive scene having 2 sets of lightmaps, Day version and Night version. LightmapSettings will be updated after the scene is loaded.
class LightmapTextures
{
public Texture2D[] lights;
public Texture2D[] dirs;
public Texture2D[] shadows;
}
public LightmapTextures[] lightmaps;
public void SetLightMap(int index)
{
LightmapTextures lightmapTextures = lightmaps[index];
LightmapData[] lightmapData = new LightmapData[lightmapTextures.lights.Length];
for(int i = 0; i < lightmapTextures.lights.Length; i++)
{
lightmapData[i] = new LightmapData();
lightmapData[i].lightmapColor = lightmapTextures.lights[i];
lightmapData[i].lightmapDir = lightmapTextures.dirs[i];
if (i < lightmapTextures.shadows.Length)
{
lightmapData[i].shadowMask = lightmapTextures.shadows[i];
}
}
LightmapSettings.lightmaps = lightmapData;
}
It works in the editor. When I build on Android, the lightmaps looks well in the beginning. But after some levels, the lightmaps will be broken until I restart the app.
And this is the view what it should look like.
Is there any setting mistake from my codes or my maps? Or is it caused by caching or out of memories?
Your answer
Follow this Question
Related Questions
How to enable normalmap baking into lightmaps on mobile? 0 Answers
Banding/Artifacts When light baking using Enlighten (Android) 0 Answers
Unity Lightmap Baking - horrible Results 4 Answers
How do I bake Ambient Occlusion map in Unity? 0 Answers
What is causing this lighting issues? And how can i fix this? 1 Answer