• Unity2022打包AssetBundle


    using System.Collections;
    using System.Collections.Generic;
    using UnityEditor;
    using UnityEngine;
    public class Export : MonoBehaviour
    {
        [MenuItem("Assets/ResourceExportWindows/BuildBundle")]
        public static void BuildBundleWindows()
        {
            BuildBundle(BuildTarget.StandaloneWindows);
        }
        static void BuildBundle(BuildTarget buildTarget)
        {
            Object obj = Selection.activeObject;
            if (null != obj)
            {
                string path = AssetDatabase.GetAssetPath(obj);
                string savePath = EditorUtility.SaveFilePanel("please select an prefab", "", obj.name, "bundle");
                if (null != savePath)
                {
                    AssetBundleBuild[] buildBuild = new AssetBundleBuild[1];
                    buildBuild[0] = new AssetBundleBuild();
                    buildBuild[0].assetBundleName = System.IO.Path.GetFileNameWithoutExtension(path) + ".bundle";
                    buildBuild[0].assetNames = new string[1];
                    buildBuild[0].assetNames[0] = path;
                    BuildPipeline.BuildAssetBundles(System.IO.Path.GetDirectoryName(savePath), buildBuild, BuildAssetBundleOptions.None, buildTarget);
                }
            }
        }
    }

  • 相关阅读:
    vue笔记(二)
    使用WPS自动化转换办公文档: 将Word, PowerPoint和Excel文件转换为PDF
    Java中锁的使用及死锁、快速幂
    AOP概念及作用
    pytorch中detach()函数以及data属性的区别+梯度求导计算
    99%必用git指令
    vue2知识点————(父子通信)
    apolloconfig分布式部署
    图书管理系统
    Centos 8 stream x64设置交换空间
  • 原文地址:https://blog.csdn.net/dive_shallow/article/details/126252058