public void BakeApply() { if (!HasBakeData) { BakeJustApplied = false; return; } if (!BakeApplied) { BakeJustApplied = RuntimeBakedLightmapUtils.InitializeInstance(this); #if UNITY_EDITOR // if (BakeJustApplied) Debug.LogWarning("[PrefabBaker] Addeded prefab lightmap data to current scene " + name); if (!Application.isPlaying) { RuntimeBakedLightmapUtils.UpdateUnityLightMaps(); } #endif } for (var i = 0; i < renderers.Length; ++i) { renderers[i].lightmapScaleOffset = renderersLightmapOffsetScale[i]; } }
static void OnBakeComplete() { // 4. Clear progress & events BakeFinished(); // 5. Fetch lightmaps, apply to prefab and save them in selected folder SaveLightmaps(); if (Window.AutoClean) { // 6. Delete scene lightmap data Lightmapping.ClearLightingDataAsset(); Lightmapping.ClearDiskCache(); Lightmapping.Clear(); } // 7. Combine prefab lightmaps with scene lightmaps EditorUtils.GetAllPrefabs().ForEach(x => RuntimeBakedLightmapUtils.InitializeInstance(x)); }