buildpipeline.buildplayer 编译播放器

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

摘要: buildpipeline.buildplayer 编译播放器static functionbuildplayer(levels: string,locationpathname: string,target:buildtarget,options: buildoptions) : stringparameters参数levelsthe scenes to be included i ...

buildpipeline.buildplayer 编译播放器

static functionbuildplayer(levels: string[],locationpathname: string,target:buildtarget,options: buildoptions) : string

parameters参数

levels

the scenes to be included in the build. if empty, the currently open scene will be built. paths are relative to the project folder (assets/mylevels/myscene.unity).

包含在编译中的场景,如果为空,当前打开的场景将被编译。路径相对于项目文件夹(assets/mylevels/myscene.unity).

locationpathname

the path where the application will be built. must include any necessary file extensions, like .exe, .app, .yzc88亚洲城 or .wdgt.

将被编译应用程序的路径,必须包括所有必要的文件扩展名。

target

thebuildtargetto build.

要编译的buildtarget。

options

additionalbuildoptions, like whether to run the built player.

添加编译选项,例如是否运行那种播放器。

returns

string - an error message if an error occurred.

如果产生错误,返回一个错误消息。

description描述

builds a player (unity pro only).

生成一个播放器(仅用于unity pro)。

use this function to programatically create a build of your project.

使用这个函数通过编程来创建一个你的项目编译。

// 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/streamedscene1.unity", "assets/streamedscene2.unity",

"assets/streamedscene3.unity"];

buildpipeline.buildplayer( levels, "streamedwebplayer.yzc88亚洲城",

buildtarget.webplayer,buildoptions.buildadditionalstreamedscenes);

}

whenbuildoptions.buildadditionalstreamedscenesis used, the resulting file will not be a traditional player. the result will be a file that can be dynamically loaded in at runtime. in order to dynamically load one of these extra scenes in, download the file using thewwwclass, and make sure to callwww.assetbundle. you don't actually have to callassetbundle.loadall(). as soon as you assignedwww.assetbundleto a variable, from that point on, you can use regularapplication.loadlevel() andapplication.loadleveladditive() calls to load the level as you would usually do.

当buildoptions.buildadditionalstreamedscenes被使用,生成的文件将不是传统的播放器。其结果将是一个可以在运行时动态加载的文件。为了动态加载另一个场景,使用www类下载文件,并确保调用了www.assetbundle。你实际上并不需要调用assetbundle.loadall()。只要你指定www.assetbundle到一个变量,通常会这样做,可以使用普通的application.loadlevel()和application.loadleveladditive() 调用来加载关卡。

// 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亚洲城文件。这包含一个场景,可以按需下载和加载,一旦它的资源包已被加载。

buildpipeline.buildplayer(

["assets/dynamicallyloadedscene.unity"], "dynamicallyloadedscene.yzc88亚洲城",

buildtarget.webplayer,buildoptions.buildadditionalstreamedscenes);

相关阅读

文章点评
相关文章