unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

Add config flag that drops -quit from builder

Open dginovker opened this issue 2 years ago • 2 comments

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

dginovker avatar Feb 16 '22 16:02 dginovker