- Home /
Loaded Lightmaps Clearing On Play
I am working on an editor tool that will allow 3D artist to load in lightmaps baked in external programs. I had the system working as two scripts that ran things on Awake - one to create the lightmaps, and the other to apply to certain renders.
However, I decided it would work better to be an editor tool that way so many things aren't happening when a scene initializes.
The problem is that once the lightmaps are loaded into the lightmap arrray (which I can see in the "lighting" tab) and I hit play, all the data is gone. Why is this data getting cleared? Do I really need to only do this in runtime?
Here is a sample of the code:
LightmapData mapdataSave = new LightmapData();
mapdataSave.lightmapNear = tempNearMap;
mapdataSave.lightmapFar = tempFarMap;
currentLightmaps.Add(mapdataSave);
LightmapData[] currentLightmapsArray = new LightmapData[currentLightmaps.Count];
for (int i = 0; i < currentLightmaps.Count; i++)
{
currentLightmapsArray = currentLightmaps;
}
LightmapSettings.lightmaps = currentLightmapsArray;
Please can you attach a screenshot of what lighting baking settings you have set i.e. the "Lightmaps" tab in the "Lighting" tab particularly if "auto" is ticked