|
In short: A browser game will still detect input from a player viewing a different tab of that browser, this is not desired and I cannot stop it. In long: I have a game where the player can click the screen to launch a ball (its a pong-like game). Now, if the player switches windows everything works fine (he can click freely, game is stopped), but if he only opens a different tab and clicks, the ball is launched. I have a check that only accepts clicks withing the window area (originally because I did not want to release the ball every time the player tried to select text on the page), but if the player clicks on that area in a different tab, the problem arises. Checking the area where the click occurred is a nice partial solution, but for a complete fix I need to be able to tell if the player can see the game window. Note that since a new tab does not change window focus, the default Unity behavior (my window lost focus -> pause game) will not save me. Ideas?
(comments are locked)
|

This is most likely a problem with whatever browser you're using. Have you tried testing this theory on all the browsers? Firefox? Chrome? Opera? IE7/8/9? It's the browser's fault for not taking focus away from the Unity object when the tab is switched, and I don't think there's anything you can do about it, short of some Javascript hack or something (and I mean REAL javascript, not the crappy Unity implementation).