03.assetbundle打包的一种用法
来源:互联网 发布:怎么推广app软件 编辑:程序博客网 时间:2024/05/22 14:19
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;public class TestBunildAssetB { //在Unity编辑器中添加菜单 [MenuItem("BuildAssetBundles/BuildSelectAssetbundle")] static void BuildAssetbundleSelect() { // 打开保存面板,选择路径并保存 string outputPath = EditorUtility.SaveFolderPanel("Build Select Assetbundle", "", ""); if (outputPath.Length != 0) { BuildTarget activeTarget = EditorUserBuildSettings.activeBuildTarget; AssetBundleBuild[] buildMap = new AssetBundleBuild[Selection.assetGUIDs.Length]; for (int i = 0; i < Selection.assetGUIDs.Length; i++) { string guid = Selection.assetGUIDs[i]; //将GUID(全局唯一标识符)转换为对应的资源路径。 //所有的路径都是相对于工程目录文件。例如” Assets/MyTextures/hello.png” string assetPath = AssetDatabase.GUIDToAssetPath(guid); //报告指定 Unicode 字符在此实例中的最后一个匹配项的索引位置。 int startindex = assetPath.LastIndexOf('/') + 1; int length = assetPath.LastIndexOf('.') - startindex; //此处是打包后的文件名;根据guid命名,并且自定义后缀名 buildMap[i].assetBundleName = assetPath.Substring(startindex, length) + ".assetbundle"; buildMap[i].assetNames = new string[1]; buildMap[i].assetNames[0] = assetPath; } //打包 BuildPipeline.BuildAssetBundles(outputPath, buildMap, BuildAssetBundleOptions.None, activeTarget); } }}
本文仅作个人学习笔记,方便复习使用
阅读全文
1 0
- 03.assetbundle打包的一种用法
- Unity3d的Assetbundle打包
- Unity5的AssetBundle(一、打包)
- AssetGraph - 好用的AssetBundle打包工具
- unity 代码设置要打包的AssetBundle
- AssetGraph - 好用的AssetBundle打包工具
- 简单总结AssetBundle的打包/解包
- AssetGraph - 好用的AssetBundle打包工具
- Unity5的AssetBundle打包方式简析
- Unity中AssetBundle的打包和加载
- 关于AssetBundle打包的编辑器扩展
- 简单总结AssetBundle的打包/解包
- 【Unity】Unity5版本的AssetBundle打包方案之资源打包
- unity3D5中的AssetBundle的打包及打包测试代码
- 项目记录05--客unity,服erlang--另外一种AssetBundle打包方式
- 打包Assetbundle并加载
- AssetBundle打包优化解决方案
- Unity 资源打包Assetbundle
- 深层神经网络实现--step by step 入门TensorFlow(二)
- 【原创】Selenium学习系列之(六)—Junit4中的注释和TestSuite
- 基于R-CNN的物体检测(转自 hjimce的专栏)
- c++初级 之 c++的字符串string
- 理解git中的head和master
- 03.assetbundle打包的一种用法
- 前端基础知识
- 记录自已学习之C语言存储区
- 深入理解Java类加载器(2):线程上下文类加载器
- 【原创】Selenium学习系列之(七)—ConnectDB和复用测试方法
- 缺失值处理方法
- IntelliJ IDEA 热部署,修改java文件 不用重启tomcat
- 【PDF下载】运维/DevOps峰会之构建通用智能运维平台
- JS源文件中文注释乱码解决