AssetBundle 资源包
Inherits from Object
AssetBundles let you stream additional assets via the WWW class and instantiate them at runtime. AssetBundles are created via BuildPipeline.BuildAssetBundle.
AssetBundles让你通过WWW类流式加载额外的资源并在运行时实例化它们。AssetBundles通过BuildPipeline.BuildAssetBundle创建。
参见: WWW.assetBundle, BuildPipeline.BuildPlayer.
function Start () {//开始下载var www = WWW ("http://myserver/myBundle.unity3d");//等待下载完成yield www;//获取指定的主资源并实例化Instantiate(www.assetBundle.mainAsset);}
Variables变量
- mainAssetMain asset that was supplied when building the asset bundle (Read Only).
主资源在构建资源boundle时指定(只读)。
Functions函数
- ContainsCheck if an AssetBundle contains a specific object.
如果AssetBundle的名称中包含特定的对象则进行检索。 - LoadLoads object with name from the bundle.
从bundle中加载名为name的对象。 - LoadAsyncAsynchronously loads object with name of a given type from the bundle.
异步地从bundle中加载被指定类型的名为name的对象。 - LoadAllLoads all objects contained in the asset bundle that inherit from type.
加载所有包含在资源bundle中且继承自type的对象。 - UnloadUnloads all assets in the bundle.
卸载包含在资源bundle中的所有对象。
Class Functions类函数
- CreateFromMemoryAsynchronously create an AssetBundle from a memory region.
从内存区异步创建资源包。
Inherited members继承成员Inherited Variables继承变量
- nameThe name of the object. //物体的名字
- hideFlagsShould the object be hidden, saved with the scene or modifiable by the user?
物体是否被隐藏、保存在场景中或被用户修改?
Inherited Functions继承函数
- GetInstanceIDReturns the instance id of the object.
返回物体的实例ID - ToStringReturns the name of the game object.
返回游戏物体的名称。
Inherited Class Functions继承类函数
- DestroyRemoves a gameobject, component or asset.
删除一个游戏物体、组件或资源 - DestroyImmediateDestroys the object obj immediately. It is strongly recommended to use Destroy instead.
立即销毁物体obj,强烈建议使用Destroy代替。 - DontDestroyOnLoadMakes the object target not be destroyed automatically when loading a new scene.
加载新场景的时候使目标物体不被自动销毁。 - FindObjectOfTypeReturns the first active loaded object of Type type.
返回Type类型第一个激活的加载的物体。 - FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
返回Type类型的所有激活的加载的物体列表 - InstantiateClones the object original and returns the clone.
克隆原始物体,并返回克隆的物体