Unity5 AssetBundle
2015-11-21 09:48
405 查看
新东西固然是好事,但是没有相关文档的情况下还是搞得我一头雾水,研究了整整一天,才搞明白这次改版的情况
新的 BuildPipeline 弃用了以前的很多函数,新创建了一个方法:
public static AssetBundleManifestBuildAssetBundles(string outputPath,
AssetBundleBuild[] builds, BuildAssetBundleOptionsassetBundleOptions =
BuildAssetBundleOptions.None,BuildTargettargetPlatform =
BuildTarget.WebPlayer);
(官方文档位置:http://docs.unity3d.com/ScriptRe
... ldAssetBundles.html)
这个方法提供几个参数,其他的参数文档说明很详细,这里只讲解新的参数:
AssetBundleBuild[] builds
这个数组其实是定义了你要打包的文件的关系 : 也就是说 将 Assets 文件夹下的哪些文件以什么样的关系进行打包.
下面以列子说明:要打包的资源如下 Assets/resources/***** 输出路径 Assets/ABs
(输出文件夹必须已经存在 否则将报错。)
![](http://forum.china.unity3d.com/data/attachment/forum/201504/02/115630u27dgz22indxn702.png.thumb.jpg)
那么 代码如下:
[C#] 纯文本查看 复制代码
?
上面代码最主要的就是那个字符数组 标明你要打包的文件位置和名称 一定要 从Assets根目录写起并且文件名一定要指明类型:
“Assets/resources/1.prefab”
新的 BuildPipeline 弃用了以前的很多函数,新创建了一个方法:
public static AssetBundleManifestBuildAssetBundles(string outputPath,
AssetBundleBuild[] builds, BuildAssetBundleOptionsassetBundleOptions =
BuildAssetBundleOptions.None,BuildTargettargetPlatform =
BuildTarget.WebPlayer);
(官方文档位置:http://docs.unity3d.com/ScriptRe
... ldAssetBundles.html)
这个方法提供几个参数,其他的参数文档说明很详细,这里只讲解新的参数:
AssetBundleBuild[] builds
这个数组其实是定义了你要打包的文件的关系 : 也就是说 将 Assets 文件夹下的哪些文件以什么样的关系进行打包.
下面以列子说明:要打包的资源如下 Assets/resources/***** 输出路径 Assets/ABs
(输出文件夹必须已经存在 否则将报错。)
![](http://forum.china.unity3d.com/data/attachment/forum/201504/02/115630u27dgz22indxn702.png.thumb.jpg)
那么 代码如下:
[C#] 纯文本查看 复制代码
?
“Assets/resources/1.prefab”
相关文章推荐
- Unity各种路径获取
- Atmospheric Scattering in Unity5
- Atmospheric Scattering in Unity5
- Unity3D 关于刚体(RigitBody)与碰撞体(Collider)的探索
- 游戏引擎中三大及时光照渲染方法介绍(以unity3d为例)
- Unity3D研究院之Time.timeScale、游戏暂停(七十四)
- 使用Unity3D的50个技巧:Unity3D最佳实践
- [UnityUI]使用UI框架
- Unity3d 调试
- Unity3D 控制角色移动,转向和自动跟随
- unity3d apk 重签名帮助提审
- Unity2D中使用鼠标拖动物体移动
- Unity3D中切换场景可能导致材质变暗的问题
- unity3d关于方法DontDestroyOnLoad的研究
- 高通AR-关于切换相机跟踪图片的控制
- 游戏蛮牛Unity 用户文档
- IOC之Unity
- Cardboard Unity SDK Reference 翻译版
- Unity3d之Shader学习资料整理
- 【Unity】Shader官方教程翻译