Ejemplo n.º 1
0
        public static void BuildAB()
        {
            //AB包输出路径
            string abOutPath = BuildABPath.GetABOutPath();

            //判断输出目录是否存在
            if (!Directory.Exists(abOutPath))
            {
                Directory.CreateDirectory(abOutPath);
            }

            //获取打包平台
            BuildTarget target = BuildTarget.NoTarget;

            switch (BuildABPath.GetPlatformName())
            {
            case "Android":
                target = BuildTarget.Android;
                break;

            case "Windows":
                target = BuildTarget.StandaloneWindows64;
                break;

            case "IOS":
                target = BuildTarget.iOS;
                break;
            }

            //打包生成
            BuildPipeline.BuildAssetBundles(abOutPath, BuildAssetBundleOptions.None, target);

            //刷新
            AssetDatabase.Refresh();
        }
Ejemplo n.º 2
0
        public static void DelAssetBundle()
        {
            string path = BuildABPath.GetABOutPath();

            Directory.Delete(path, true);
            File.Delete(path + ".meta");
            AssetDatabase.Refresh();
        }