最简单的打包方式

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class menuitem : Editor
{
//菜单项
    [MenuItem("create/click")]
    static void A() {
//选中的多个资源
        GameObject[] games = Selection.gameObjects;
        foreach (var item in games)
        {
              //资源的路径
            string path = AssetDatabase.GetAssetPath(item);
            //通过路径获得资源
            AssetImporter ai = AssetImporter.GetAtPath(path);
           //ab包的名字
            ai.assetBundleName = "cube";
        }
        //打包逻辑
        BuildPipeline.BuildAssetBundles("Assets/AB",BuildAssetBundleOptions.None,BuildTarget.StandaloneWindows64);
    }
}
阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页