• 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
0
Question by Bill · May 10, 2010 at 06:21 PM · webplayermouseclick

Web browser mouse behaviour

It appears that Unity is still capturing mouse input when the mouse is outside of the web plug-in. For instance, if I have an html button control (within the webpage) and I click it, Unity is still registering that I clicked the mouse. Is there anyway to make unity only register mouse clicks when the plug-in application has focus?

Comment
Add comment · Show 2
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 Molix · May 10, 2010 at 07:54 PM 0
Share

I think it also still captures it if you've got Unity open in one tab, switch to another tab and click in the same screen area where the plugin is on the first tab.

avatar image tistik · Nov 14, 2011 at 09:19 PM 0
Share

Any news concerning this issue ? I would be interested in a way to prevent the Web Player from receiving inputs when the user is browsing another webpage (or even is using another application).

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by spinaljack · May 11, 2010 at 09:46 AM

You can add an extra check for mouse screen position to stop it registering clicks outside of the window

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 Bill · May 11, 2010 at 04:53 PM 0
Share

As molix pointed out, this doesn't help in the scenario were a tabbed page is currently on top. Clicking links on the tabbed page (that is within the same area of the unity application) will still cause the events to fall though. When outside of the unity app, we would like it to no longer receive input.

avatar image
0

Answer by jonas-echterhoff · May 25, 2010 at 10:54 AM

Can you describe what setup you are using? Which browser? Which mouse? and how are you polling the mouse? Safari 4 on OS X 10.6 has some known bugs with respect to focus handling (which we cannot work around).

However, in any browser, using the GUI events (see Event class), you should only get clicks inside the plug-in view. Input.GetMouseButton() may be different in some cases.

Comment
Add comment · Show 3 · 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 FizixMan · Jun 21, 2010 at 05:07 PM 0
Share

I'm getting the same behaviour on Windows XP, both Firefox and IE8. I'm polling the mouse via the standard Input handlers from an example: Input.GetAxis("Horizontal"), and the "Horizontal" axis is tied to the mouse button in the project input settings.

I also noticed that it happens wherever I click in the browser, even on the UI (like its address bar), but only after I click on the browser once. The first click isn't registered, but subsequent ones are captured by Unity.

avatar image FizixMan · Jun 21, 2010 at 06:35 PM 0
Share

Woops, I said Input.GetAxis("Horizontal"), I meant Input.GetAxis("Fire1") which is mapped to the mouse button.

avatar image jonas-echterhoff ♦♦ · Jun 22, 2010 at 07:55 AM 0
Share

Ok, I'm not 100% sure about the windows side of things, as I'm mostly a mac guy, but I know that we have some pending fixes related to web player focus handling co$$anonymous$$g up for 3.0, which should most likely cover this problem.

avatar image
0

Answer by AlucardJay · Jan 06, 2015 at 04:42 AM

Maybe you can try OnApplicationFocus or OnApplicationPause?

Source : http://answers.unity3d.com/questions/37095/web-player-ignore-input-if-doesnt-have-focus.html

Comment
Add comment · 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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Unity Web Player does not respond to mouse clicks 1 Answer

WebGL Fast Left Mouse Click issues (Sometimes they are not recognized in Chrome) 0 Answers

Can people access my game assets through the webplayer? 3 Answers

Performance difference between webPlayer and Flash? 0 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