2015-04-30 60 views
6

我想從命令行只建立一個統一的3d項目,沒有伴隨構建管道靜態方法。如何從命令行設置統一構建場景路徑

我的嘗試失敗了,統一抱怨''是不正確的場景路徑。我不能從命令行設置場景路徑嗎?

"C:\Program Files\Unity\Editor\Unity.exe" -batchmode -nographics -quit -projectPath "C:\unity-project" -buildWindowsPlayer "C:\unity-project\test.exe" "C:\unity-project\Assets\Scene_01.unity"

給出了錯誤:

Aborting batchmode due to failure: '' is an incorrect path for a scene file. BuildPlayer expects paths relative to the project folder.

我得到同樣的錯誤,如果我更改目錄到項目路徑並使用Assets\Scene_01.unity,和這麼多的變化。

編輯 值審判現場

Scene_01.unity

./Scene_01.unity

.\Scene_01.unity

Assets/Scene_01.unity

Assets\Scene_01.unity

./Assets/Scene_01.unity

.\Assets\Scene_01.unity

/Assets/Scene_01.unity

\Assets\Scene_01.unity

注意,沒有在那裏,我已經能夠找到它說,你甚至可以在指定的場景(S)命令行。我覺得團結不希望我這樣做。

回答

1

您無法從命令行定義要構建的場景名稱。 Unity將存儲將在ProjectSettings/EditorBuildSettings.asset中構建的場景您唯一的解決方法是在使用命令行之前確保構建設置對於您想要的場景是正確的,或者創建您自己的自定義靜態函數您可以傳入場景文件名並以此方式啓動構建器。

+2

我希望你錯了,但我認爲你不是。 – payo

-1

BuildPlayer expects paths relative to the project folder.

這個錯誤看起來很簡單。似乎你必須使用相對於項目文件夾的路徑,在你的情況下,它是\Assets\Scene_01.unity

+0

謝謝你的迴應。不幸的是,這沒有奏效(同樣的錯誤)。我想指出以斜線開頭的路徑是慣例中的絕對路徑。所以這有效,我不會認爲這是「直截了當」。 – payo

+0

您是否嘗試過'Assets \ Scene_01.unity','Assets/Scene_01.unity','。/ Assets/Scene_01.unity'和'Scene_01.unity'? –

+0

我已經更新了我的問題 - 但是,我試過所有這些變化。我將在統一論壇上重新發布這個問題。 – payo