public bool SyncToProject() { AssetBundleCollection assetBundleCollection = new AssetBundleCollection(); assetBundleCollection.OnLoadingAssetBundle += delegate(int index, int count) { if (OnLoadingAssetBundle != null) { OnLoadingAssetBundle(index, count); } }; assetBundleCollection.OnLoadingAsset += delegate(int index, int count) { if (OnLoadingAsset != null) { OnLoadingAsset(index, count); } }; assetBundleCollection.OnLoadCompleted += delegate() { if (OnCompleted != null) { OnCompleted(); } }; if (!assetBundleCollection.Load()) { return(false); } int assetIndex = 0; int assetCount = assetBundleCollection.AssetCount; AssetBundle[] assetBundles = assetBundleCollection.GetAssetBundles(); foreach (AssetBundle assetBundle in assetBundles) { Asset[] assets = assetBundle.GetAssets(); foreach (Asset asset in assets) { AssetImporter assetImporter = AssetImporter.GetAtPath(asset.Name); if (assetImporter == null) { if (OnCompleted != null) { OnCompleted(); } return(false); } assetImporter.assetBundleName = assetBundle.Name; assetImporter.assetBundleVariant = assetBundle.Variant; assetImporter.SaveAndReimport(); if (OnAssetBundleDataChanged != null) { OnAssetBundleDataChanged(++assetIndex, assetCount, asset.Name); } } } if (OnCompleted != null) { OnCompleted(); } return(true); }
public AssetBundle[] GetAssetBundles() { return(m_AssetBundleCollection.GetAssetBundles()); }