usingUnityengine;usingSystem.Collections;usingUnityeditor;usingSystem.IO; Public classChangename:monobehaviour {//public string Versiondir;//public string Abname; voidStart () { for(inti =0;i< -; i++) { stringPath ="res/com/face/prefab/0_"+i; stringAbname ="face0_"+i; Setversiondirassetname (Path,abname); } } Public voidSetversiondirassetname (stringVersiondir,stringabname) { varFullPath = Application.datapath +"/"+ Versiondir +"/"; varRelativelen = Versiondir.length +8;//Assets Length if(Directory.Exists (FullPath)) {Editorutility.displayprogressbar ("Set Assetname name","Setting the Assetname name ...", 0f); varDIR =NewDirectoryInfo (FullPath); varFiles = dir. GetFiles ("*", searchoption.alldirectories); for(vari =0; I < files. Length; ++i) {varFileInfo =Files[i]; Editorutility.displayprogressbar ("Set Assetname name","Setting the Assetname name ...", 1f * I/files. Length); if(!fileinfo.name.endswith (". Meta")) { varBasePath = fileInfo.FullName.Substring (Fullpath.length-relativelen). Replace ('\\','/'); varImporter =Assetimporter.getatpath (BasePath); if(Importer && Importer.assetbundlename! =Versiondir) {Importer.assetbundlename=Abname; }}} Editorutility.clearprogressbar (); } }}
Batch setup Assetbundlename