using System.Collections;
using System.Collections.Generic;
using UnityEngine;//运行期间用
using UnityEditor;//编辑状态用
public class AssetBundle : Editor
{
public static Object[] Objs = new Object[] { };
[MenuItem("Assets/AssetsBundle/BuildSelectObjects")]
static void BuildSelect()
{
//获取所有选中的对象
Objs = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
//弹出一个编辑窗口;
AssetBundleWindow.ShowWindow();
}
/// <summary>
/// 开始打包;
/// </summary>
public static void StartBuild()
{
Debug.Log("开始打包!");
string path = AssetBundleWindow.AsbPath;
Debug.Log("选择路径:" + path);
//设置出asb[]
AssetBundleBuild abb = new AssetBundleBuild();
abb.assetNames = new string[Objs.Length];
for (int i = 0; i < Objs.Length; i++)
{
abb.assetNames[i] = AssetDatabase.GetAssetPath(Objs[i]);
}
超级好用的Unity中的AssetBundle打包脚本,
最新推荐文章于 2024-04-08 15:03:18 发布