U3D assetbundle打包

时间:2022-02-20 22:17:12
using UnityEngine;
using System.Collections;
using UnityEditor; //此脚本不一定要放于editor目录下,经测试,放于其它地方也可以
public class testAB { //public static 类型的变量是不会出现在UI上的,因为出现在UI的脚本是实例化的脚本,是属于特定对象的
public static string varTest = "vartest"; [MenuItem("Assets/BuildAssetBundle/WIN32")]
static void BuildAssetBundle() //注意此方法必须是这种样子:静态无参无返回值,否则编辑器不认,菜单出不来
{
//将多个assetbundle打包到Assets/AssetBundles/目录下,工程中有多少个Asset Label就会打出多少个assetbundle
BuildPipeline.BuildAssetBundles("Assets/AssetBundles");
}
}

U3D assetbundle打包