lightmapping issues

I have a single scene where I activate/deactivate several sets of GameObjects at runtime. I can’t simply bake the entire scene with all of the objects active because that obviously doesn’t create lightmaps that look right when only some of the objects are active at runtime (shadows cast by inactive objects, etc). I need a way to bake different lightmaps for specific sets of objects and not lose all of the tiling and index info from each object’s renderer whenever I do a new bake. I tried the old Beast Helper script since it allows exactly what I need, but it’s horribly broken and simply doesn’t work. I also tried simply altering the LightmapSettings.lightmaps array at runtime, but again ran into issues with objects losing their tiling and index info after each bake.

I feel like what I’m trying to do should be trivial and that I must be missing something. What’s the easiest way to do what I want?

The simplest thing is to not bake lightmaps for those objects at all, and make sure they are not marked “static”, and have “cast shadows” selected. Make sure realtime shadows are turned on, and the items will cast shadows that blend into the lightmaps when you are up close, and when you are far away, you won’t notice the lack of lightmaps.

There is also a utility to load and unload lightmaps in the asset store, but I have never tried it.

if you have a massive scene with detailed objects turing on realtime shadows could totally kill your frame rate. id suggest using an external tool like 3d max or maya, match the lightmapping, and create lightmaps there, then use the lightmap shader in unity

It could, if your shadow distance is set way too high. I keep mine down to less than 30 meters, and let everything else lightmap. Haven’t noticed a speed difference at all. Now, this is of course completely dependent on the scene in question - but it’s definitely worth a try since it would take like 5 minutes to test.