Hi, I’m modifying a lightmap. All the changes are shown correctly in the game view and in the editor, however if I open the lightmap image in Photoshop, all the changes are gone. If I reimport the lightmaps, all the changes are also gone.
Here’s my code:
List <Color[]> lightmapsPixels = new List<Color[]>();
//Get all lightmap pixels
for (int i = 0; i < lightmapsList.Count; i++) {
Texture2D lightmapTexture = LightmapSettings.lightmaps[i].lightmapFar;
Helper.SetTextureImporterFormat(lightmapTexture, TextureImporterFormat.AutomaticTruecolor, true); //Make the texture truecolor and readable
lightmapsPixels.Add( lightmapTexture.GetPixels() );
}
... do the changes to lightmapsPixels data...
for (int i = 0; i < lightmapsPixels.Count; i++) {
Texture2D lightmapTexture = LightmapSettings.lightmaps[i].lightmapFar;
lightmapTexture.SetPixels( lightmapsPixels[i] );
lightmapTexture.Apply();
LightmapSettings.lightmaps[i].lightmapFar = lightmapTexture;
}
What am I doing wrong? Why aren’t my changes kept in the actual lightmap files?
Thanks!