private static void JoinOn(PrefabBaker prefab, LightmapData newData) { var hashCode = prefab.GetLightMapHashCode(); if (string.IsNullOrEmpty(hashCode)) { return; } if (!prefabToLightmap.TryGetValue(hashCode, out LightMapPrefabStorage storage)) { storage = new LightMapPrefabStorage { lightData = new List <LightmapData>(4) }; } bool addedNew = true; var hashCodeOfLightData = GetHashCodeCustom(newData); foreach (var item in storage.HashCodes) { if (item == hashCodeOfLightData) { addedNew = false; break; } } if (addedNew) { storage.lightData.Add(newData); storage.HashCodes.Add(hashCodeOfLightData); prefabToLightmap[hashCode] = storage; } }
private static void RemoveEmpty(PrefabBaker prefab, LightMapPrefabStorage toRemoveData) { var sceneLightmaps = CurrentFrameLightData; int count = sceneLightmaps.Count; for (int j = 0; j < count; j++) { int hash = GetHashCodeCustom(sceneLightmaps[j]); foreach (var item in toRemoveData.lightData) { if (hash == GetHashCodeCustom(item)) { sceneLightmaps[j] = new LightmapData(); } } } if (prefab != null) { actionsToPerform.Add(new ActionStruct { prefab = prefab, AddOrRemove = false }); } IsLightMapsChanged = true; }