Context
My team has a situation where we can’t run playtests because of asmdef’s in Unity not working with our project flow, but instead found a way to validate things in-game by running a scene from the command line (scene is started from a static method). We want to start the scene to run the tests before a build, but you can't enter playmode from a static method in -batchmode if -quit is also present.
A configuration option that allows removing -quit from the Unity command line parameters would solve our issue (although it means we need to handle the exiting of the editor ourselves with EditorApplication.Exit(0))
Suggested solution
Add a config like
quit
Bool whether the editor should quit after building
Note: If quit is disabled, your build method must handle exiting Unity with EditorApplication.Exit(0) on its own
required: false default: true
Considered alternatives
Forking the builder and monkey patching it
Additional details
We can't call /opt/unity/Editor/Unity ourselves since it's gone when you leave the build step. It would also mean we have to redo the licensing/etc
The following is some bash code that can handle the optionally passing -quit, although I don't have an equivalent for the Powershell build.ps1
#!/usr/bin/env bash
function printparams() {
echo "$@"
echo "$#"
}
quit=""
printparams \
${quit} \
-two
quit="-quit"
printparams \
${quit} \
-two
Context
My team has a situation where we can’t run playtests because of asmdef’s in Unity not working with our project flow, but instead found a way to validate things in-game by running a scene from the command line (scene is started from a static method). We want to start the scene to run the tests before a build, but you can't enter playmode from a static method in
-batchmodeif-quitis also present.A configuration option that allows removing
-quitfrom the Unity command line parameters would solve our issue (although it means we need to handle the exiting of the editor ourselves withEditorApplication.Exit(0))Suggested solution
Add a config like
quit
Bool whether the editor should quit after building
Note: If quit is disabled, your build method must handle exiting Unity with
EditorApplication.Exit(0)on its ownrequired: false default: true
Considered alternatives
Forking the builder and monkey patching it
Additional details
We can't call
/opt/unity/Editor/Unityourselves since it's gone when you leave the build step. It would also mean we have to redo the licensing/etcThe following is some bash code that can handle the optionally passing -quit, although I don't have an equivalent for the Powershell build.ps1