buildpipeline.buildstreamedsceneassetbundle 编译流场景资源包

2015-1-3 22:27| 发布者: 杨炎| 查看: 3203| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: buildpipeline.buildstreamedsceneassetbundle 编译流场景资源包static functionbuildstreamedsceneassetbundle(levels: string,locationpath:string,target:buildtarget) :stringdescription描述builds one or more ...

buildpipeline.buildstreamedsceneassetbundle" target="_blank" class="relatedlink">assetbundle 编译流场景资源

static functionbuildstreamedsceneassetbundle(levels: string[],locationpath:string,target:buildtarget) :string

description描述

builds one or more scenes and all it's dependencies into a compressed asset bundle.

编译一个或多个场景和所有它依赖的压缩资源包。

the scene assetbundle can be built for any target platform and always creates a single compressed yzc88亚洲城 file.

该场景资源包可以内置任意目标平台,并总是创建单一压缩的yzc88亚洲城文件

the scene can be downloaded and loaded using the www class. you can usewww.loadfromcacheordownloadto cache the downloaded scene after it has been downloaded.

该场景可以被下载并使用www类加载。可以使用www.loadfromcacheordownload已经被下载后,来缓存下载的场景。

// build a streamed yzc88亚洲城 file. this contain one scene that can be downloaded

// on demand and loaded once it's asset bundle has been loaded.

//构建一个流yzc88亚洲城文件,包含一个场景,可以按需下载,一旦资源包加载时加载。

@menuitem("build/buildwebplayerstreamed")

static function mybuild(){

var levels : string[] = ["assets/level1.unity"];

buildpipeline.buildstreamedsceneassetbundle( levels, "streamed-level1.yzc88亚洲城", buildtarget.webplayer);

}

when downloading the built compressed file, you need to callwww.assetbundlein order to make the scene available to theapplication.loadlevel() andapplication.loadleveladditive() functions.

当下载内置的压缩文件,必须调用www.assetbundle以使场景application.loadlevel()和application.loadleveladditive()函数可用。

function start () {

// download compressed scene. if version 5 of the file named "streamed-level1.yzc88亚洲城" was previously downloaded and cached.

// then unity will completely skip the download and load the decompressed scene directly from disk.

//下载压缩的场景。如果名为streamed-level1.yzc88亚洲城的文件版本为5,预先下载并缓存。

//然后unity将完全跳过下载并直接从磁盘加载解压的场景。

var download =www.loadfromcacheordownload("http://mywebsite.com/streamed-level1.yzc88亚洲城", 5);

yield download;

// handle error

if (download.error != null)

{

debug.logerror(download.error);

return;

}

// in order to make the scene available from loadlevel, we have to load the asset bundle.

// the assetbundle class also lets you force unload all assets and file storage once it is no longer needed.

//为了使场景loadlevel可用,必须加载资源包

//assetbundle类,还可以强制卸载所有的资源和文件存储,一旦不再需要。

var bundle = download.assetbundle;

// load the level we have just downloaded

//加载刚才下载的关卡

application.loadlevel("level1");

}

相关阅读

文章点评
相关文章