I'm a bit of a novice to lighting, but I think what I want to do is possible, so please bear with me.
Due to the nature of my game, I've taken an approach where a singular scene game is where all of the gameplay occurs.
For each level, I'm arranging all the GameObjects and Terrain in a secondary scene (named testbed) to my liking. Once I've got it to my liking, I save that to a prefab, which in turn is saved to an AssetBundle. I also generate the lighting at this point, which I can see appear in my project under a Assets/Scenes/testbed/ folder.
At runtime, a script in the game scene reads the appropriate AssetBundle, and then loads & positions all of my objects and characters. Everything about this works, except for updating the lighting.
My approach is to store references to the lighting textures that have been output into the aforementioned testbed folder via a ScriptableObject (after trying and failing to use the LightingData object that appearred in this same folder):
Then, when I'm loading my level up into the game scene, this block is executed:
public void LoadLighting(LevelKey key)
{
var data = levelMap.metaData.Find(it => it.key == key);
var directions = data.lightData.directions;
var lights = data.lightData.lights;
var lightmaps = new LightmapData[directions.Length];
for (int i = 0; i < directions.Length && i < lights.Length; i++)
{
var lightmapData = new LightmapData();
lightmapData.lightmapDir = directions[i];
lightmapData.lightmapColor = lights[i];
lightmaps[i] = lightmapData;
}
LightmapSettings.lightmaps = lightmaps;
}
Based on a lot of searching, this should cause something to happen, but I can't detect any change in the scene.
Does what I'm trying make any sense? Should I just scrap this and make dozens of different scenes (which I'm trying to avoid) instead? Really any advice here is appreciated.
