public void SetAssetBundleName() { string result = string.Empty; foreach (var info in _assetsMap) { result += EPathHelper.GetName(info.Key) + "_"; } if (_refMap.ContainsKey(result)) { UnityEngine.Debug.LogError("重复的名字" + result); } foreach (var info in _assetsMap) { AssetBundleSetNameE.SetAbNameByParam(info.Key, result); } }
public const string SUFFIX_ANIM = "*.anim"; // 文件后缀名 //[MenuItem("Tools/优化/动画内存优化")] public static void AllSeoAnimation() { List <string> anim_paths = EPathHelper.GetAssetsPath(anim_directory, true, SUFFIX_ANIM); int length = anim_paths.Count; for (int i = 0; i < length; i++) { AnimationClip clip = AssetDatabase.LoadAssetAtPath <AnimationClip>(anim_paths[i]); if (clip == null) { continue; } _seo_animation(clip); EditorUtility.DisplayProgressBar(anim_paths[i], string.Format("动画内存优化({0}/{1})", i + 1, length), (float)(i + 1) / length); } ShowDialog(); }
public void OnSearchTextures(string searchPath) { _shows.Clear(); List <string> pathList = EPathHelper.GetAssetsPath(searchPath, true, "*.*"); int length = pathList.Count; for (int i = 0; i < length; i++) { if (!EPathHelper.IsTexture(pathList[i])) { continue; } var tmp = TextureFormatInfo.Create(pathList[i]); _shows.Add(tmp); } _texShowTablePanel.RefreshData(_shows); _formatRule = null; }
public static TextureFormatInfo Create(string assetPath) { TextureFormatInfo info = GetInfo(assetPath); TextureImporter importer = AssetImporter.GetAtPath(assetPath) as TextureImporter; Debug.Assert(!(importer == null), "错误的地址:" + assetPath); if (importer == null) { return(null); } // 1.初始化纹理格式化信息 info.Path = importer.assetPath; info.ImportType = importer.textureType; info.ImportShape = importer.textureShape; info.ReadWriteEnable = importer.isReadable; info.MipmapEnable = importer.mipmapEnabled; info.IsSpriteTag = !string.IsNullOrEmpty(importer.spritePackingTag); info.AndroidFormat = GetPlatformTextureSettings(importer, AssetFormatConst.PLATFORM_ANDROID); info.IosFormat = GetPlatformTextureSettings(importer, AssetFormatConst.PLATFORM_IOS); // 计算纹理的大小内存占用 Texture texture = AssetDatabase.LoadAssetAtPath <Texture>(assetPath); info.Width = texture.width; info.Height = texture.height; info.AndroidSize = EMemorySizeHelper.CalculateTextureSizeBytes(texture, info.AndroidFormat); info.IosSize = EMemorySizeHelper.CalculateTextureSizeBytes(texture, info.IosFormat); info.MemSize = (int)(Mathf.Max(info.AndroidSize, info.IosSize)); info.FileSize = EPathHelper.GetFileSize(assetPath); if (Selection.activeObject != texture) { Resources.UnloadAsset(texture); } if (++LoadCount % 256 == 0) { Resources.UnloadUnusedAssets(); } return(info); }
// 查找指定目录下的所有动画文件 public static List <AnimationClip> _find_animation_clip(string folderPath) { List <AnimationClip> clips = new List <AnimationClip>(); List <string> animsPath = EPathHelper.GetAssetsPath(folderPath, false, _searchSuffix); int length = animsPath.Count; for (int i = 0; i < length; i++) { EditorUtility.DisplayProgressBar("加载动画文件,", animsPath[i], (1 + i) / length); AnimationClip clip = AssetDatabase.LoadAssetAtPath <AnimationClip>(animsPath[i]); if (clip == null) { continue; } clips.Add(clip); } EditorUtility.ClearProgressBar(); return(clips); }
public static void Excute() { // 1.得到当前的Img路径 int length = _spritePath.Length; List <string> imgFiles = new List <string>(); for (int i = 0; i < length; i++) { List <string> tmpFiles = EPathHelper.GetAssetsPath(_spritePath[i], true); imgFiles.AddRange(tmpFiles); } // 2.根据路径设置Img的SpriteTag length = imgFiles.Count; for (int i = 0; i < length; i++) { EditorUtility.DisplayProgressBar("设置图片的SpriteTag", imgFiles[i], (float)(i) / length); SetImgTag(imgFiles[i]); } // 3.保存 EditorUtility.ClearProgressBar(); AssetDatabase.SaveAssets(); }
public BuildAssetInOneAb(string path) { _directory = path; _abName = EPathHelper.AbsoluteToRelativePathRemoveAssets(_directory); _init(); }