Lightmapping.Bake without replacing bake

polycounter lvl 4
Offline / Send Message
echofourpapa polycounter lvl 4
Hi everyone,

I've encountered a problem where scenes with lightmaps are baked on one machine, committed to a git repo, and then built on another, the static geometry "breaks". I'm assuming it has to with the re-built static vertex list either not being transferred or being recalculated somehow. Either way the bug has been reported to Unity(I don't have a reference number readily available). While I wait to on the real fix, I think I may have found a workaround.

To fix the issue I open each scene, click bake, and then I can build and the game is fine. The bakes don't take that long because since nothing has changed there's nothing to re-bake. This process is manual, and I'm looking to automate it.

I have an editor script that gathers a list of scene paths, opens the scene, calls Lightmapping.Bake() then saves the assets and scene, for each scene then builds the project. This works. I can work with multiple static lightmapped scenes over git and keep static batching turned on.

However, I think that Lightmapping.Bake is completely re-baking the scenes from scratch and storing new lightmaps. Should this be happening? It's definitely time consuming, but it's not breaking anything(since I have the scenes setup to be baked in their native state).

Is there a better way to workaround this problem, maybe?


NOTE: I've also posted this to the Unity forums here.


Sign In or Register to comment.