Unity editor focus for GameDriver tests

Troubleshoot test focus issues by enabling Unity apps to run in the background

You may find your Unity test does not run correctly unless the editor is in focus, or the test fails to progress unless the editor window is not focused on. This is due to a setting in Unity where runInBackground is set to false, which is easy to remedy. This question was answered on Unity Answers some time ago, although the linked scripting reference page is no longer available.

Simply add the following line somewhere in your application code, and it should be set:

Application.runInBackground = true;

You can also set this value in the Standalone Player settings under Edit --> Project Settings --> Player --> Resolution and Presentation --> Run In Background, as shown in the screenshot below.