static void ExportAssetBundles() {
string [] Folder = {"Resources/", "Resources/mats/"};
foreach( string path in Folder){
string [] fileEntries = Directory.GetFiles(Application.dataPath+"/"+path);
foreach(string filePath in fileEntries) {
string fileName= filePath;
int index = fileName.LastIndexOf("/");
fileName = fileName.Substring(index+1);
Debug.Log("fileName:"+fileName);
string localPath = "Assets/" + path;
if (index > 0)
localPath += fileName;
Debug.Log("resource localPath:"+localPath);
Object t = AssetDatabase.LoadMainAssetAtPath(localPath);
if (t != null) {
Debug.Log(t.name);
string bundlePath = "Assets/" + path + t.name + ".unity3d";
Debug.Log("Building bundle at: " + bundlePath);
BuildPipeline.BuildAssetBundle(t, null, bundlePath, BuildAssetBundleOptions.CompleteAssets);
}
}
}
}
string [] Folder = {"Resources/", "Resources/mats/"};
foreach( string path in Folder){
string [] fileEntries = Directory.GetFiles(Application.dataPath+"/"+path);
foreach(string filePath in fileEntries) {
string fileName= filePath;
int index = fileName.LastIndexOf("/");
fileName = fileName.Substring(index+1);
Debug.Log("fileName:"+fileName);
string localPath = "Assets/" + path;
if (index > 0)
localPath += fileName;
Debug.Log("resource localPath:"+localPath);
Object t = AssetDatabase.LoadMainAssetAtPath(localPath);
if (t != null) {
Debug.Log(t.name);
string bundlePath = "Assets/" + path + t.name + ".unity3d";
Debug.Log("Building bundle at: " + bundlePath);
BuildPipeline.BuildAssetBundle(t, null, bundlePath, BuildAssetBundleOptions.CompleteAssets);
}
}
}
}