public static void UpdateAllAssetCaches() { bool assetCacheFound = false; IEnumerable <IAssetCache> assetCaches = GetAllAssetCaches(); int numCaches = assetCaches.Count(); for (int i = 0; i < numCaches; i++) { IAssetCache assetCache = assetCaches.ElementAt(i); EditorUtility.DisplayProgressBar($"Updating {numCaches} Asset Caches...", $"Updating the {assetCache.GetType().Name}'s Asset Caches.", i / (float)numCaches); assetCache.UpdateAssetCache(); assetCache.SaveAssets(); assetCacheFound = true; } EditorUtility.ClearProgressBar(); if (!assetCacheFound) { Debug.LogWarning("No asset caches were found in the project. Unable to update asset caches."); return; } AssetDatabase.SaveAssets(); Debug.Log("Asset caches updated."); }