找回密碼
 注冊帳號

掃一掃,訪問微社區

buildpipeline.buildplayer 編譯播放器

2015-1-3 22:17| 發布者: 楊炎| 查看: 6162| 評論: 0|原作者: 蠻牛|來自: unity3d腳本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, .unity3d 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 unity3d file. this contain one scene that can be downloaded

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

//生成一個流unity3d文件。這包含一個場景,可以按需下載和加載,一旦它的資源包已被加載。

@menuitem("build/buildwebplayerstreamed")

static function mybuild(){

var levels :string[] = ["assets/streamedscene1.unity", "assets/streamedscene2.unity",

"assets/streamedscene3.unity"];

buildpipeline.buildplayer( levels, "streamedwebplayer.unity3d",

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 unity3d file. this contain one scene that can be downloaded

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

//生成一個流unity3d文件。這包含一個場景,可以按需下載和加載,一旦它的資源包已被加載。

buildpipeline.buildplayer(

["assets/dynamicallyloadedscene.unity"], "dynamicallyloadedscene.unity3d",

buildtarget.webplayer,buildoptions.buildadditionalstreamedscenes);

相關閱讀

文章點評
相關文章
女校游泳队彩金 山东11选5走势一定牛 南粤36选7开奖结果今晚 南粤风采36选7最新走势 网络广告联盟赚钱 排列五浙江十一选五开奖号码 配资图片 吉林11选五一定走势图 福建快3走势图开奖结果 1青海11选5开奖结果 浙江十一选五开奖走 深圳风采开奖结果玩法 欧冠积分榜16强赛程 分分彩后三走势图pp 贵阳捉鸡麻将技巧秘 贵州快3手机 河内5分彩官方开奖网址