没有合适的资源?快使用搜索试试~ 我知道了~
Unity3D制作并使用Assetbundles方法1
需积分: 0 0 下载量 133 浏览量
2022-08-08
19:37:18
上传
评论
收藏 53KB DOCX 举报
温馨提示
试读
2页
Unity3D制作并使用Assetbundles方法 Posted on 2013年07月16日 by U3d / Unity3D脚本/插件 /被围观 35 次
资源详情
资源评论
资源推荐
Unity3D 制作并使用 Assetbundles 方法
Posted on 2013 年 07 月 16 日 by U3d / Unity3D 脚本/插件 /被围观 35 次
在网页中为了控制.unity 文件的大小,加速载入速度,可以把系统用到的资源制作成
Assestbundles,根据需要进行动态的加载和卸载。具体作法:
1、使用脚本重新定义系统菜单,添加一个制作 Assetbunles 的菜单命令:
01
// C# Example
02
// Builds an asset bundle from the selected objects in the project view.
03
// Once compiled go to "Menu" -> "Assets" and select one of the choices
04
// to build the Asset Bundle
05
06
using UnityEngine;
07
using UnityEditor;
08
09
public class ExportAssetBundles {
10
[MenuItem("Assets/Build AssetBundle From Selection - Track
dependencies")]
11
static void ExportResource () {
12
// Bring up save panel
13
string path = EditorUtility.SaveFilePanel ("Save Resource", "",
"New Resource", "unity3d");
14
if (path.Length != 0) {
15
// Build the resource file from the active selection.
16
Object[] selection = Selection.GetFiltered(typeof(Object),
SelectionMode.DeepAssets);
17
BuildPipeline.BuildAssetBundle(Selection.activeObject,
selection, path, BuildAssetBundleOptions.CollectDependencies |
BuildAssetBundleOptions.CompleteAssets);
18
Selection.objects = selection;//Unity3D
教程手册:
www.unitymanual.com
19
}
20
}
21
[MenuItem("Assets/Build AssetBundle From Selection - No dependency
tracking")]
22
static void ExportResourceNoTrack () {
23
// Bring up save panel
24
string path = EditorUtility.SaveFilePanel ("Save Resource", "",
"New Resource", "unity3d");
25
if (path.Length != 0) {
26
// Build the resource file from the active selection.
27
BuildPipeline.BuildAssetBundle(Selection.activeObject,
Selection.objects, path);
28
}
29
}
30
}
今年也要加油呀
- 粉丝: 16
- 资源: 312
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0