Unity命令列打包

2022-06-18 10:06:11 字數 1007 閱讀 5191

補充unity編輯器端獲取打包命令列自定義引數,這個可以獲取到所有打包時的引數

string runargs = system.environment.getcommandlineargs();

一、在assets\editor目錄下放個指令碼

using unityengine;

using unityeditor;

using system;

using system.io;

using system.collections.generic;

/// /// 命令列批處理工具類

///

public class batchmode

editoruserbuildsettings.switchactivebuildtarget(buildtarget.android);

string res = buildpipeline.buildplayer( levels.toarray(), "android.apk", buildtarget.android, buildoptions.none );

if (res.length > 0)

throw new exception("buildplayer failure: " + res);

}}

二、寫個批處理(路徑改成自己的工程路徑)

@echo off

@set unity="c:\program files\unity\editor\unity.exe"

echo 正在生成apk檔案...

%unity% -batchmode -quit -nographics -executemethod batchmode.buildandroid -logfile d:\editor.log -projectpath "d:\china\2014-11-12_client_wushen_android"

echo apk檔案生成完畢!

pause

Unity 命令列打包

在寫文章之前先說下unity已經自帶了視覺化打包,我為什麼要多此一舉進行命令列打包,估計剛接觸unity的小夥伴都會有這樣的疑惑,當你遊戲要發布到android平台你就會知道,需要接不通平台的sdk,甚至有些平台還需要改包名。而遊戲從接完平台sdk,到發布還需要經過無數次的測試,發布後甚至還需若干次...

命令列下檔案打包

windows rar 1 打包桌面所有檔案 rar.exe a k r s m3 d 1.rar c users bezal desktop 2 只打包指定字尾檔案 只打包doc字尾檔案 n doc rar.exe a k r s m3 tk n doc d 4.rar c users bezal...

命令列打包以及jenkins使用

首先命令列打包我用的是xcodebuild以及xcrun兩個工具。相當簡單 打包命令 xcodebuild target 工程名字 configuration release clean build 首先clean以及編譯工程 jenkins的使用 啟動tomcat下的jenkins 進入路徑 us...