How to keep Unity rendering when focus is not set to game window

Im using UDP to control the unity environment. Ive written a test app to send data into unity that consists of a dozen buttons, faders, and some XY pads. When i set OSX’s focus to my test app (read: select the test app as the active application in the title bar), unity stops re-drawing the game. Essentially i either need to run the app on a second machine, which is a PITA when i am just knocking things around on my laptop (95% of my dev cycle) - or write automated code inside my test app which simulates human interaction with the app (which i have done already).

Does anyone have a solution for getting Unity to keep drawing, even when focus is not set to it within the OS?

Put Application.runInBackground = true; somewhere in your code and you should be good to go.

See the documentation:
http://unity3d.com/support/documentation/ScriptReference/Application-runInBackground.html

No need to add code. There’s a tickbox in the player settings.

Go to Edit->Project Settings->Player, select the ‘Standalone’ tab, and ‘Resolution & Presentation’.
Now check the ‘Run In Background’ tickbox.

thanks guys - you just made me a happy man today.

many thanks guys! I’ve been looking that so many times :slight_smile: