public static void PrepareBundleAssetsMap() { BundleManifest manifest = AssetDatabase.LoadAssetAtPath <BundleManifest>(manifestAssetPath); if (manifest == null) { manifest = ScriptableObject.CreateInstance <BundleManifest>(); AssetDatabase.CreateAsset(manifest, manifestAssetPath); } else { manifest.ClearBundleData(); } string[] bundleNames = AssetDatabase.GetAllAssetBundleNames(); foreach (string bundleName in bundleNames) { foreach (string assetName in AssetDatabase.GetAssetPathsFromAssetBundle(bundleName)) { manifest.AddBundleAssetPath(assetName, bundleName); } manifest.AddBundleData(bundleName, AssetDatabase.GetAssetBundleDependencies(bundleName, true)); } EditorUtility.SetDirty(manifest); AssetDatabase.LoadAssetAtPath <BundleManifest>(manifestAssetPath); AssetImporter importer = AssetImporter.GetAtPath(manifestAssetPath); importer.assetBundleName = manifestName; }