AssetsBundle 打包

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class PackageTools : Editor{

//StreamingAssets移动平台的流路径,他会把所有丢进去的文件变成byte[]

    //打包到本地使用LZ4打包,资源大小比较大,但是加载解包速度快
    //打包到网络上面推荐使用LZMA打包,资源包比较小

[MenuItem("MyTools/PackageToLocal")]        //自定义一个编辑器按钮,父按钮的名字叫MyTools和file按钮同级,下面有个子按钮叫PackageToLocal
public static void PackageToLocal (){
    BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath,BuildAssetBundleOptions.ChunkBasedCompression,BuildTarget.StandaloneWindows64);       //5.x要用这个api去打包
}

[MenuItem("MyTools/PackageToSever")]        //自定义一个编辑器按钮,父按钮的名字叫MyTools和file按钮同级,下面有个子按钮叫PackageToLocal
public static void PackageToSever()
{
    BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);       //5.x要用这个api去打包
}

[MenuItem("MyTools/PackageToAndroidLocal")]        //自定义一个编辑器按钮,父按钮的名字叫MyTools和file按钮同级,下面有个子按钮叫PackageToLocal
public static void PackageToAndroidLocal()
{
    BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.Android);       //5.x要用这个api去打包
}

[MenuItem("MyTools/PackageToAndoirdSever")]        //自定义一个编辑器按钮,父按钮的名字叫MyTools和file按钮同级,下面有个子按钮叫PackageToLocal
public static void PackageToAndroidServer()
{
    BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.None, BuildTarget.Android);       //5.x要用这个api去打包
}

}

你可能感兴趣的:(AssetsBundle 打包)