How to add new baked lightmaps to lightmap array?

I want to create several separate set of lightmaps for the same scene using different lighting settings in order to depict different times of day outdoors.

From reading the documentation, it looks like you're supposed to be able to put additional lightmaps into the Map Array and then point to a particular index for a particular renderer or terrain at runtime.

However, whether or not I check Lock Atlas before I bake, my new lightmap textures replace the previous set.

What am I doing wrong?

The lightmap array is actually fixed by the lightmapper based on how many lightmaps are needed in the atlas to cover all the lightmaps at the specified resolution.

What I wanted to do was substitute different lightmap textures in existing array slots at runtime. Here's how:

  1. Set up your realtime lighting for the time of day you want to represent.
  2. Bake your lightmaps.
  3. Rename the lightmap folder (which will be next to the scene file in the Project) to represent the time of day and move it to the Resources folder.
  4. Change your lighting again.
  5. Bake again.
  6. Save your lightmaps off to the side again.

This code will load a lightmap texture set from Resources into the lightmapdata at runtime:

        function SetLightMaps (pathString: String) {
    // pass in the path to the location of the lightmaps, starting below the "Resources" folder.
var lightmaparray : LightmapData[] = LightmapSettings.lightmaps;
var mapdata : LightmapData = new LightmapData();
for (var i=0; i<lightmaparray.length; i++) {
    mapdata.lightmapFar = UnityEngine.Resources.Load(pathString + "LightmapFar-" + i.ToString(), Texture2D) as Texture2D;
    mapdata.lightmapNear = UnityEngine.Resources.Load(pathString + "LightmapNear-" + i.ToString(), Texture2D) as Texture2D;
    lightmaparray *= mapdata;*
*}*
*LightmapSettings.lightmaps = lightmaparray;*
*```*
*<p>}</p>*

function SetLightMaps (pathString: String) {
// pass in the path to the location of the lightmaps, starting below the “Resources” folder.
var lightmaparray : LightmapData = LightmapSettings.lightmaps;
var mapdata : LightmapData = new LightmapData();
for (var i=0; i<lightmaparray.length; i++) {
mapdata.lightmapFar = UnityEngine.Resources.Load(pathString + “LightmapFar-” + i.ToString(), Texture2D) as Texture2D;
mapdata.lightmapNear = UnityEngine.Resources.Load(pathString + “LightmapNear-” + i.ToString(), Texture2D) as Texture2D;
lightmaparray = mapdata;
}
LightmapSettings.lightmaps = lightmaparray;