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.
645 stars 90 forks source link

Does not work with Probuilder #21

Closed christianhanne closed 3 years ago

christianhanne commented 4 years ago

First of all, thanks for this awesome script. It works like a charm with most models.

Unfortunately there seems to be a problem with meshes created with Probuilder. When creating a model with probuilder inside Unity and using it as a prefab, the lightmaps seem to be misplaced. Also when using a complex prefab with Probuilder elements and normal elements, all normal elements (thanks to your script) have the correct lighting. All Probuilder elements look messed up. Therefore I think this is a problem of Probuilder.

I will recreate the affected elements outside of Unity now. Just leaving this as a comment so others won't have to search forever.

Ayfel commented 4 years ago

Oh that's interesting I wonder if Probuilder is doing some sort of batching and messing up the UVs, are the probuilder prefabs "static"? try removing it if so. I haven't played with probuilder but if I do I will keep it in mind : )

christianhanne commented 4 years ago

Sorry, for my late reply. I tried both, static and non-static. Neither one worked for me. I think this is because Probuilder adds the meshes on the fly through the added Probuilder Script. The Prefabs also are always displayed as overwritten when used in a scene. So I think this is just a problem with the inner workings of Probuilder.