AssetBundle.mainAsset 主资源

var mainAsset : Object

Description描述

Main asset that was supplied when building the asset bundle (Read Only).

主资源在构建资源boundle时指定(只读)。

This is a convenience function that makes it easy to find the primary asset of a bundle. For example you might want to have a prefab of a character and include all textures, materials, meshes and animations files with it. But the fully rigged prefab of the character would be your mainAsset and can easily be accessed.

该功能可以方便的找到bundle内的主资源。例如,你也许想有一个角色的预制体并包括所有纹理、材质、网格和动画文件。但是完全操纵角色的预设体应该是你的mainAsset并且易于被访问。

function Start () {
	var www = new WWW ("http://myserver/myBundle.unity3d");
	yield www;
	//获取指定的主资源并实例化
	Instantiate(www.assetBundle.mainAsset);
}
最后修改:2010年12月10日 Friday 20:41

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。