找回密碼
 注冊帳號

掃一掃,訪問微社區

assetbundle 資源包

2014-12-31 15:31| 發布者: 楊炎| 查看: 1831| 評論: 0|原作者: 蠻牛|來自: unity3d腳本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.unity3d");

//等待下載完成

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.

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

文章點評
极速时时彩开奖最快的网站