using System.Collections.Generic; using UnityEditor; public class ChangedConfigsProcessor : AssetPostprocessor { private static void OnPostprocessAllAssets( string[] imported, string[] deleted, string[] moved, string[] moved_from_paths ) { var accum = new List(10); FilterConfigFiles(imported, accum); FilterConfigFiles(deleted, accum); FilterConfigFiles(moved, accum); FilterConfigFiles(moved_from_paths, accum); if (accum.Count == 0) return; //TODO: animate it properly someday EditorUtility.DisplayProgressBar("Building configs", "In progress...", 0.3f); try { BuildUtils.Urun(); } finally { EditorUtility.ClearProgressBar(); } } private static void FilterConfigFiles(IEnumerable paths, ICollection accum) { const string metagenConf = ".conf.js"; const string bhlConf = ".bhl"; foreach (string path in paths) { if (accum.Contains(path)) continue; if (path.EndsWith(metagenConf) || path.EndsWith(bhlConf)) accum.Add(path); } } }