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 garanon · Dec 13, 2011 at 05:10 AM · uimouse

Put mouse to sleep

I'm trying to create a UI for the main menu that can use mouse or arrow buttons to select the new, load, option buttons etc.

Both are working fine, however I want to disable the mouse once a key is pushed, and remain disabled until it is moved again. Currently if the mouse is over a button and I push the down key, the option will not be able to change as the mouse is still hovering over the first option

Is there a way to put the mouse "to sleep" once these buttons are pushed, and then wake when it is moved again?

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 Oninji · Dec 13, 2011 at 05:54 AM

Well the simple way would be to have a boolean that keep track of when or not the mouse should be used. Then put a if(!mouseEnabled){ //Your mouse react to button code here. }

So that your buttons do not react to your mice.

Comment
Add comment · Show 2 · 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 garanon · Dec 13, 2011 at 07:05 AM 0
Share

I couldn't get this to work for my situation because when the mouse is disabled it will still act as the highlighted button. I wan't it to be as if the mouse disappeared and is no longer interacting with it

A temporary fix I can think of is when the up, down button is pressed the mouse moves to 0,0 and when the mouse is touched again it moves back to where it was. That sort of explains it acting as if it were not on the object, but surely there is a more professional way to achieve this :P

avatar image Oninji · Dec 13, 2011 at 03:27 PM 0
Share

Well, you could lock the mouse to screen and when the condition "mouseEnabled" is false, set the texture of the mouse to a transparent one.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How can I disable gamepad input, for my UI? 1 Answer

Prevent raycast to OnMouseOver() or OnMouseEnter() when mouse over UI 1 Answer

Unity UI Mouse + Keyboard navigate, Un-Highlight button choice on mouse over 0 Answers

(4.6 UI) How to highlight a character/unit when moused over? 1 Answer

Trouble with unlocking cursor 1 Answer


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