Script for saving lightmapping data to prefabs. Used through the Assets tab in Unity. Place your prefbas in the scene with this script at the root. Set up your lighting and in the editor go to Assets->Bake Prefab Lightmaps. After is processed you can now spawn your prefabs in different scenes and they will use the lightmapping from the original scene.
My lightmaps are misaligned when using this script for baking. I use Unity 2020.1.12f and have some complicated and unoptimized geometry.
I think the reason is that the script usesBakeAsync() without waiting for the bake to complete. Instead it assigns the currently existing lightmaps immediatly. Or nothing if no lightmap existed.
However when starting the bake in Unity and after completion running the script without the BakeAsync() call everything is working fine and aligned correctly.
In any case, this script is a tremendous help. Thank you.
My lightmaps are misaligned when using this script for baking. I use Unity 2020.1.12f and have some complicated and unoptimized geometry.
I think the reason is that the script uses
BakeAsync()
without waiting for the bake to complete. Instead it assigns the currently existing lightmaps immediatly. Or nothing if no lightmap existed.However when starting the bake in Unity and after completion running the script without the
BakeAsync()
call everything is working fine and aligned correctly.In any case, this script is a tremendous help. Thank you.