Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by user5200 · Oct 25, 2012 at 10:08 PM · 2dmousescreenwindow

Preventing mouseclicks outside the game window

Hi,

I am making a 2D sprite-based brawler type of game that (unlike most others) utilize mouseclicks quite extensively.

Because of the frantic nature of the gameplay, testers are finding that they accidentally click outside the window (in windowed mode) much more often than we'd like. I was wondering if Unity has an option to disable all interactions outside of the window while the game is running.

I have read this topic: http://answers.unity3d.com/questions/273902/disabling-view-of-mouse-outside-of-unity-window.html

This seems like a good solution except that it hides the mouse cursor and restricts its movement inside the window. Is there anything like this but allowing regular mouse movement within the game window?

Edit: The ideal solution would allow full movement and clicking inside the game window but would not allow the cursor to exit the window while the game is running.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sfc.itzhak · Oct 25, 2012 at 10:43 PM

is the issue that you loose focus?

or you just dont want them to accidently click outside?

for the first one you can click on reun in background and it wont effect gameplay.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image user5200 · Oct 26, 2012 at 02:19 AM 0
Share

Hi,

Thanks for your input. However, I have tried this approach and since it loses focus on the game window, it was deemed to be too disruptive to gameplay.

Also, If you have a full screen browser or something in the background it will cover the game. As it remains running in the background, when you return, you will probably be dead.

It would be best if the mouse could not exit the game window while the game is running.

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Top-Down 2D game:How to make the camera move on hitting the sides of the screen? 2 Answers

Making a ball follow my mouse only on the y axis, and let it automatically move on x axis 2D 2 Answers

window mode and full screen mode 1 Answer

How to make a 2D character points his gun to the mouse position? 2 Answers

How to always have the mouse curser in the center of your game ? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges