示例#1
0
    /// <summary>
    /// 清除ab文件名
    /// </summary>
    /// <param name="path"></param>
    private static void ClearAssetBundleName(string path)
    {
        Caching.CleanCache();
        try
        {
            if (Directory.Exists(path))
            {
                string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    //后缀名
                    string ext = Path.GetExtension(path);
                    if (!BuildAB.IsNoPack(ext))
                    {
                        string filePath = BuildAB.ConvertPath(file);

                        AssetImporter importer = AssetImporter.GetAtPath(filePath);
                        if (importer)
                        {
                            if (importer.assetBundleName != "")
                            {
                                importer.assetBundleName = "";
                            }
                        }
                    }
                }
            }
        }
        catch (Exception e)
        {
            Debug.Log(e.Message + ",清除AB名字出错");
        }
    }