Skip to content

Add config flag that drops -quit from builder #13

@dginovker

Description

@dginovker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions