using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
public class BuildAssetBundle
{
[MenuItem("Tools/BuildAllAssetBundles")]
public static void BuildAllAssetBundles()
{
Debug.Log(Application.dataPath + "/AB_Res");
string ABOutPath = PathTools.GetABOutPath();//等待PathTools 编写完毕 ,把这部分放到里面去
if (!Directory.Exists(ABOutPath))
{
Directory.CreateDirectory(ABOutPath);
}
BuildPipeline.BuildAssetBundles(ABOutPath, BuildAssetBundleOptions.None, GetPlatform());
Debug.Log("AB包打包完毕");
AssetDatabase.Refresh();
}
public static BuildTarget GetPlatform()
{
BuildTarget buildTarget = BuildTarget.StandaloneWindows64;
switch (Application.platform)
{
case RuntimePlatform.IPhonePlayer:
buildTarget = BuildTarget.iOS;
break;
case RuntimePlatform.Android:
buildTarget = BuildTarget.Android;
break;
case RuntimePlatform.WindowsPlayer:
case RuntimePlatform.WindowsEditor:
buildTarget = BuildTarget.StandaloneWindows64;
break;
}
return buildTarget;
}
}
--若是对您有所帮助,世界便多了一份你我的温暖
--您的支持将是我的动力,手有余粮的话,一点点赞赏我将开心不已(一毛钱也是极好的)