assetbundle 资源包

2014-12-31 15:31| 发布者: 杨炎| 查看: 2047| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: assetbundle 资源包inherits fromobjectassetbundles let you stream additional assets via the www class and instantiate them at runtime. assetbundles are created viabuildpipeline.buildassetbundle.assetbu ...

assetbundle" target="_blank" class="relatedlink">assetbundle 资源

inherits fromobject

assetbundles let you stream additional assets via the www class and instantiate them at runtime. assetbundles are created viabuildpipeline.buildassetbundle.

assetbundles让你通过www类流式加载额外的资源并在运行时实例化它们。assetbundles通过buildpipeline.buildassetbundle创建。

参见:www.assetbundle,buildpipeline.buildplayer.

function start () {

//开始下载

var www =www("http://myserver/mybundle.yzc88亚洲城");

//等待下载完成

yield www;

//获取指定的主资源并实例化

instantiate(www.assetbundle.mainasset);

}

variables变量

mainasset

main asset that was supplied when building the asset bundle (read only).

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

functions函数

contains

check if an assetbundle contains a specific object.

如果assetbundle的名称中包含特定的对象则进行检索。

load

loads object with name from the bundle.

从bundle中加载名为name的对象。

loadasync

asynchronously loads object with name of a given type from the bundle.

异步地从bundle中加载被指定类型的名为name的对象。

loadall

loads all objects contained in the asset bundle that inherit from type.

加载所有包含在资源bundle中且继承自type的对象。

unload

unloads all assets in the bundle.

卸载包含在资源bundle中的所有对象。

class functions类函数

createfrommemory

asynchronously create an assetbundle from a memory region.

从内存区异步创建资源包。

inherited members继承成员

inherited variables继承变量

name

the name of the object. //物体的名字

hideflags

should the object be hidden, saved with the scene or modifiable by the user?

物体是否被隐藏、保存在场景中或被用户修改?

inherited functions继承函数

getinstanceid

returns the instance id of the object.

返回物体的实例id

tostring

returns the name of the game object.

返回游戏物体的名称。

inherited class functions继承类函数

destroy

removes a gameobject, component or asset.

删除一个游戏物体、组件或资源

destroyimmediate

destroys the object obj immediately. it is strongly recommended to use destroy instead.

立即销毁物体obj,强烈建议使用destroy代替。

dontdestroyonload

makes the object target not be destroyed automatically when loading a new scene.

加载新场景的时候使目标物体不被自动销毁。

findobjectoftype

returns the first active loaded object of type type.

返回type类型第一个激活的加载的物体。

findobjectsoftype

returns a list of all active loaded objects of type type.

返回type类型的所有激活的加载的物体列表

instantiate

clones the object original and returns the clone.

克隆原始物体,并返回克隆的物体

文章点评