- Home /
Web Player ignore input if doesn't have focus
Is there a way to keep a game running in the background, but have it ignore user input? I.e. is there a flag that I can check whether the game has focus or not? Or some other mechanism to achieve this?
This actually seems to work okay everywhere except OS X on Safari.
Thanks
Answer by Statement · Dec 07, 2010 at 12:17 PM
Maybe you can try OnApplicationFocus or OnApplicationPause?
Answer by dkozar · Aug 18, 2012 at 02:34 AM
I had some focus problems on Mac today: Unity didn't register mouse down events on the left 2/3rds of the screen (though registered mouse moves normally).
Though it previously worked well, it started (I guess) with a new player version.
The problem was me messing with DIVs on the HTML page while Unity was loading (showing the alternative content when no player installed etc.) So, if you got focus problems, it might be because of your custom host page!
Also, use always the latest version of UnityObject.js, e.g. always like to the online version of the script (on Unity servers), because Unity team could update the script to make it work with a new player version.
Answer by jonas-echterhoff · Dec 07, 2010 at 12:13 PM
Safari has a bug related to sending focus messages to plugins, which may be causing this. You can test this, does the problem go away if you set Safari to 32-bit mode in the info panel in the Finder? If it does, then it is this known Safari bug (which I have reported to Apple).