x


Changing tabs in a browser does not take focous from app.

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?

more ▼

asked May 20 '10 at 09:46 PM

gotranto gravatar image

gotranto
1 1 1 1

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).

May 20 '10 at 09:50 PM qJake
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5056
x982
x951
x810
x6

asked: May 20 '10 at 09:46 PM

Seen: 1041 times

Last Updated: May 20 '10 at 09:46 PM