Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set unity build scene path from command line

Tags:

unity3d

I am trying to build a unity 3d project from command line only, without a companion build pipeline static method.

My attempts fail, unity complains about '' is an incorrect scene path. Can I not set the scene path from command line?

"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"

Gives the error:

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

I get the same error if I change directory to the project path and use Assets\Scene_01.unity, and many variation of this.

EDIT Values tried for the scene

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

Note that no where that I've been able to find does it say you can even specify the scene(s) on command line. I feel unity doesn't want me doing this.

like image 434
payo Avatar asked Apr 30 '15 06:04

payo


1 Answers

You can't define the scene name(s) to be built from the command line. Unity stores the scenes that will be built in the ProjectSettings/EditorBuildSettings.asset Your only way around this is to make sure that the build settings are correct with the scenes you want before using the command line, or to create your own custom static function that you can pass in your scene file name(s) and start the builder that way.

like image 130
Colton White Avatar answered Sep 28 '22 19:09

Colton White