- Home /
Change player settings to enable run in background from the command line
Currently, I am trying to solve a test automation problem.
The system is creating a new project, importing a package and building game with all of the default settings. After that, we are running the built scene and running some graphics recognition tests. However, there is no focus guarantee, as another program may take it during the test. This leads to false positive failures (the test is failing, but there is no problem). This will be solved by Run In Background.
How can this option be enabled for the project through a CLI? Can the Player Settings be adjusted when creating or building (again, via CLI)? There is the option to force it, but we are testing samples sent to clients, so I would like to avoid a solution that may override their settings.
Answer by hexagonius · Jul 28, 2018 at 05:40 AM
turns out it's a runtime setting you can just set:
https://docs.unity3d.com/ScriptReference/Application-runInBackground.html
As I mentioned, I am aware of the option to force it. However, that would require changing the script in the sample we ship. That is something we are looking to avoid, as it will override the default settings. What I am looking for is to change the settings during the build from CLI. It is an unattended operation and will not affect the code shipped nor the behavior of the project.