| | |
| | | public class UpdateLevelSetting
|
| | | {
|
| | | static string exportMapsPath = Application.dataPath + "/Editor/Config/ExportMaps.txt";
|
| | | static string rootPath = Application.dataPath + "/Art/Maps/Scenes";
|
| | | static string assetPath = "Assets/Art/Maps/Scenes";
|
| | | static string rootPath = Application.dataPath + "/ResourcesOut/Scenes";
|
| | | static string assetPath = "Assets/ResourcesOut/Scenes";
|
| | | static HashSet<string> exportMaps;//去除的地图列表
|
| | |
|
| | | static string rootTexturePath = Application.dataPath + "/ResourcesOut/Texture";
|
| | | static string assetTexturePath = "Assets/ResourcesOut/Texture";
|
| | |
|
| | |
|
| | | [MenuItem("程序/设置资源包名/更新Level(All) AssetBundleName")]
|
| | |
| | | {
|
| | | // ReadExportConfig();
|
| | |
|
| | | // var allFiles = new DirectoryInfo(rootPath).GetFiles("*.unity", SearchOption.TopDirectoryOnly);
|
| | | // foreach (var file in allFiles)
|
| | | // {
|
| | | // var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;
|
| | | // var importer = AssetImporter.GetAtPath(importerPath);
|
| | | // var name = Path.GetFileNameWithoutExtension(file.FullName);
|
| | | // if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包
|
| | | // importer.assetBundleName = "";
|
| | | // else
|
| | | // importer.assetBundleName = "maps/" + name.ToLower();
|
| | | var allFiles = new DirectoryInfo(rootPath).GetFiles("*.unity", SearchOption.TopDirectoryOnly);
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var importerPath = assetPath + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | var name = Path.GetFileNameWithoutExtension(file.FullName);
|
| | | // if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包
|
| | | // importer.assetBundleName = "";
|
| | | // else
|
| | | importer.assetBundleName = "maps/" + name.ToLower();
|
| | |
|
| | | // // EditorUtility.SetDirty(importer);
|
| | | // }
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | // var createRoleAssets = AssetDatabase.FindAssets("t:prefab", new string[] { "Assets/ResourcesOut/Scene/CreateRole" });
|
| | | // foreach (var item in createRoleAssets)
|
| | |
| | | // // EditorUtility.SetDirty(importer);
|
| | | // }
|
| | |
|
| | | // var textures = AssetDatabase.FindAssets("t:Texture2D", new string[] { "Assets/ResourcesOut/Scene/Textures" });
|
| | | // var textures = AssetDatabase.FindAssets("*.jpg", new string[] { "Assets/ResourcesOut/Texture/FullScreenBg" });
|
| | | // foreach (var item in textures)
|
| | | // {
|
| | | // var importer = AssetImporter.GetAtPath(AssetDatabase.GUIDToAssetPath(item));
|
| | |
| | | // }
|
| | | // exportMaps?.Clear();
|
| | | // exportMaps = null;
|
| | |
|
| | | allFiles = new DirectoryInfo(rootTexturePath).GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var importerPath = assetTexturePath + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | var name = Path.GetFileNameWithoutExtension(file.FullName);
|
| | | // if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包
|
| | | // importer.assetBundleName = "";
|
| | | // else
|
| | | importer.assetBundleName = "maps/" + name.ToLower();
|
| | |
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | allFiles = new DirectoryInfo(rootTexturePath).GetFiles("*.png", SearchOption.TopDirectoryOnly);
|
| | | foreach (var file in allFiles)
|
| | | {
|
| | | var importerPath = assetTexturePath + Path.DirectorySeparatorChar + file.Name;
|
| | | var importer = AssetImporter.GetAtPath(importerPath);
|
| | | var name = Path.GetFileNameWithoutExtension(file.FullName);
|
| | | // if (exportMaps.Contains(name)) //判断这个地图是否被排除,被排除不打包
|
| | | // importer.assetBundleName = "";
|
| | | // else
|
| | | importer.assetBundleName = "maps/" + name.ToLower();
|
| | |
|
| | | // EditorUtility.SetDirty(importer);
|
| | | }
|
| | |
|
| | | Debug.Log("map资源包名更新完成!");
|
| | | // AssetDatabase.SaveAssets();
|
| | | // AssetDatabase.Refresh();
|