Ejemplo n.º 1
0
    public static void ReBuildAllAssetBundles()
    {
        if (MyEditorTools.IsPlaying())
        {
            return;
        }
        string outputPath = outPut;

        Directory.Delete(outputPath, true);
        Debug.LogError("删除目录: " + outputPath);
    }
Ejemplo n.º 2
0
 public static void ClearAssetBundlesName()
 {
     if (MyEditorTools.IsPlaying())
     {
         return;
     }
     //清除Ab包资源名
     string[] abNames = AssetDatabase.GetAllAssetBundleNames();
     for (int i = 0; i < abNames.Length; i++)
     {
         AssetDatabase.RemoveAssetBundleName(abNames[i], true);
     }
     Debug.LogError("清除全部资源AssetBundle名称完成!");
 }
Ejemplo n.º 3
0
    public static void BuidldBundles()
    {
        if (MyEditorTools.IsPlaying())
        {
            return;
        }
        if (!Directory.Exists(resPath))
        {
            Debug.LogError("资源路径不存在:" + resPath);
        }
        if (!Directory.Exists(outPut))
        {
            Directory.CreateDirectory(outPut);
        }
        if (!Directory.Exists(Application.streamingAssetsPath))
        {
            Directory.CreateDirectory(Application.streamingAssetsPath);
        }
        //把热更文件拷贝进来
        //CopyHotFix();

        //清除Ab包资源名
        string[] abNames = AssetDatabase.GetAllAssetBundleNames();
        for (int i = 0; i < abNames.Length; i++)
        {
            AssetDatabase.RemoveAssetBundleName(abNames[i], true);
        }
        Debug.LogError("清除全部资源AssetBundle名称完成!");
        SetAssetsBundleName(resPath);
        Debug.LogError("设置AssetBundle名称完成!");
        EditSpritAtlas.SetUIAtlas();
        BuildPipeline.BuildAssetBundles(outPut, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
        CreateAssetBundleFileInfo();
        AssetDatabase.Refresh();
        Debug.LogError("AssetBundle打包完成!");
    }