private static void SetScenePrefabABName(ref List <AssetsInfo> depList) { var targetList = new List <AssetsInfo>(); for (int i = depList.Count - 1; i >= 0; i--) { var info = depList[i]; if (info.category != AssetsCategory.Model && info.category != AssetsCategory.UI && info.refCount > 1 && string.IsNullOrEmpty(info.abName) && info.extension.Equals(".prefab")) { targetList.Add(info); SetDepAB(info.path, ABConfig.GetSceneDepPrefabABName(info.name)); depList.Remove(info); } } var list = ABHelper.GetDepList(ABHelper.GetDependencies(targetList)); foreach (var info in list) { if (info.type != AssetsType.Shader) { var abName = info.GetFirstRefAB(); SetDepAB(info.path, ABConfig.GetSceneDepPrefabABName(abName)); } } }
/// <summary> /// 场景材质球和它关联的贴图一起打AB,如果贴图依赖大于1时,贴图单独打 /// </summary> /// <param name="depList"></param> private static void SetSceneMaterialABName(ref List <AssetsInfo> depList) { var targetList = new List <AssetsInfo>(); for (int i = depList.Count - 1; i >= 0; i--) { var info = depList[i]; if (info.type == AssetsType.Material && info.category != AssetsCategory.Model && info.category != AssetsCategory.UI && string.IsNullOrEmpty(info.abName)) { targetList.Add(info); SetAB(info.path, ABConfig.GetSceneDepMaterialABName(info.name)); depList.Remove(info); } } var list = ABHelper.GetDepList(ABHelper.GetDependencies(targetList)); foreach (var info in list) { if (info.type != AssetsType.Shader) { if (info.refCount > 1) { SetABIfEmpty(info.path, info.name.ToLower()); } else { var abName = info.GetFirstRefAB(); SetABIfEmpty(info.path, ABConfig.GetSceneDepMaterialABName(abName)); } } } }
public static void ResetAllDepABNameByAnalyzeDepdencies() { BuildLog.Log("ResetAllDepABNameByAnalyzeDepdencies ..."); var depList = ABHelper.GetDepList(ABHelper.GetAllDependencies()); ClearAllDepABName(depList); SetSceneMaterialABName(ref depList); SetScenePrefabABName(ref depList); SetDepABName(depList); SetShaderABName(); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); BuildLog.Log("ResetAllDepABNameByAnalyzeDepdencies DONE!"); }