- Home /
How do i keep my game from losing focus
Ok so i am trying to make my game stay in full screen unless u press alt tab or the windows key. It does this but if i move my mouse out of the bounds of the screen to my second monitor is closes how can i force the mouse to be stuck inside to bounds of the main monitor where the game is. If you have any tutorials or anything , it would be appreciated much thxs :)
I'd say that if someone is playing your game full-screen, with a 2nd monitor, they want to be able to click over on screen #2.
A trick is, in build settings, turn on/off(?)(don't have Unity up) "Run in Background." Then they can still click off the screen, but the game won't stop (but $$anonymous$$r. 2-monitors may want it to pause.)
Answer by amphoterik · Jul 05, 2013 at 02:55 PM
You can lock the cursor. The downside to this is that you then have to handle your own mouse and click events. If you are doing a game like an FPS, then this shouldn't be a problem.
Info on locking cursor can be found here: http://docs.unity3d.com/Documentation/ScriptReference/Screen-lockCursor.html
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Exploide GameObjects Into BrokenParts : Unity 1 Answer
Stop movement at edge of screen! 2d shooter 4 Answers
Playing outside of the Unity Game Editor 2 Answers