Unity-Lightmap-Prefab-Baker
Unity-Lightmap-Prefab-Baker copied to clipboard
trying to bake complex prefabs causes index out of range error
This plugin is amazing, but unfortunately it breaks down when you throw prefabs with a large amount of static components at it:
Assertion failed on expression: 'm_PendingLightmapHashes.size() == m_LightmapCompositeHashes.size()'
IndexOutOfRangeException: Index was outside the bounds of the array.
PrefabLightMapBaker.Baker.SaveSceneLightmap (System.Int32 lightmap_index, System.String name) (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:202)
PrefabLightMapBaker.Baker.GetOrSaveSceneLightmapToAsset (System.Int32 lightmap_index, System.String name) (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:157)
PrefabLightMapBaker.Baker+<>c__DisplayClass8_0.<SaveLightmaps>b__1 (UnityEngine.MeshRenderer r) (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:130)
System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
PrefabLightMapBaker.Baker+<>c.<SaveLightmaps>b__8_0 (PrefabLightMapBaker.PrefabBaker prefab) (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:130)
System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
PrefabLightMapBaker.Baker.SaveLightmaps () (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:124)
PrefabLightMapBaker.Baker.OnBakeComplete () (at Assets/Plugins/PrefabBaker/Scripts/Editor/Baker.cs:90)
UnityEditor.Lightmapping.Internal_CallBakeCompletedFunctions () (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
I already tried playing around with all the available settings like baked / mixed mode and texture size, they don't seem to make a difference. This error always occurs right after baking is finished.
share an example project to replicate this error