How to set assembly build path from command line

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

My attempts fail, unity complains about the "wrong path to the script." Can I set the scene path from the 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 an 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 the directory to the project path and use Assets\Scene_01.unity , and many variations of this.

EDIT Values ​​tried for 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 there is no where I could find if he could say that you can specify the scene on the command line. I feel that unity does not want me to do this.

+6
source share
2 answers

You cannot define the names (names) of the scene to be created from the command line. Unity stores the scenes that will be created in ProjectSettings / EditorBuildSettings.asset. The only way around this is to make sure the build settings are correct with the scenes you want before using the command line, or create your own static function that you can pass the script file name to and run it that way.

+1
source

BuildPlayer expects paths relative to the project folder.

This error seems pretty simple. It looks like you should use the path relative to the project folder, which in your case is \Assets\Scene_01.unity .

-1
source

Source: https://habr.com/ru/post/986268/


All Articles