using UnityEngine; using UnityEditor; using UnityEngine.SceneManagement; public class ftRestorePaddingMenu { [MenuItem("Bakery/Utilities/Re-adjust UV padding", false, 43)] private static void RestorePadding() { var bakeryRuntimePath = ftLightmaps.GetRuntimePath(); var gstorage = AssetDatabase.LoadAssetAtPath(bakeryRuntimePath + "ftGlobalStorage.asset", typeof(ftGlobalStorage)) as ftGlobalStorage; if (gstorage == null) { Debug.Log("Bakery is not initalized"); return; } if (EditorUtility.DisplayDialog("Bakery", "Re-unwrap and reimport lightmapped scene models to match last bake?", "OK", "Cancel")) { var sceneCount = SceneManager.sceneCount; int reimported = 0; for(int i=0; i(); if (store == null) continue; for(int j=0; j= 0) { if (dataExisting.padding[ind] != data.padding[k]) { dataExisting.padding[ind] = data.padding[k]; updated = true; } if (dataExisting.unwrapper[ind] != data.unwrapper[k]) { dataExisting.unwrapper[ind] = data.unwrapper[k]; updated = true; } } else { dataExisting.meshName.Add( data.meshName[k] ); dataExisting.padding.Add( data.padding[k] ); dataExisting.unwrapper.Add( data.unwrapper[k] ); updated = true; } } } if (updated) { #if UNITY_2017_1_OR_NEWER gstorage.SyncModifiedAsset(mstoreIndex); #endif EditorUtility.SetDirty(gstorage); (AssetImporter.GetAtPath(path) as ModelImporter).SaveAndReimport(); reimported++; } } } Debug.Log(reimported > 0 ? ("Updated " + reimported + " models") : "No changes detected"); } } }