Ayfel / PrefabLightmapping

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.
618 stars 88 forks source link

Misaligned lightmaps when using BakeAsync() #27

Closed brunce closed 3 years ago

brunce commented 3 years ago

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.

Ayfel commented 3 years ago

I have returned it to Bake() until I have time to test and implement the async version properly, which I hadnt