When our game is run on Mac through the Steam client, it appears that the window immediately loses focus after creation, and, if it’s not running fullscreen, is sent behind all other windows on the desktop. The player then has to cmd-tab to the game if it’s windowed, or click on it if it’s fullscreen, before the game registers any interaction.
The following events are coming through before the first update:
Oddly there’s no OnApplicationFocus(False). If the game isn’t set to “Run in Background”, then we get just one call to Update() until the player manually restores focus to the app.
This only happens when running through Steam—running a build normally is fine. The current build uses Unity 4.6.6, but the same issue also hit us with 4.5 and 5.
Has anybody experienced similar behaviour? Is there any way to manually restore focus to a Unity app? I was thinking about writing an Objective C++ plugin to call the appropriate Cocoa API to restore focus, but that seems a little overkill.