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
0
Question by MrSteve1 · Apr 10, 2013 at 07:40 PM · onmouseup

OnMouseUP sometimes doesn't work

Hi All.

Just wondering if anyone else has experienced this before. I have a simple script that uses function OnMouseUp() to instantiate a menu, however I have noticed sometimes it doesn't work depending on how much stuff is going on on screen.

Has this this happended to you? Did you fix it?

Thanks

Steve

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by fafase · Apr 10, 2013 at 07:42 PM

You would not have it in the FixedUpdate?

If so, you need to place it in the Update.

Comment
Add comment · Show 4 · 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 MrSteve1 · Apr 10, 2013 at 07:58 PM 0
Share

Ah, I have been using it as another function, do you mean I should use "if(Input.Get$$anonymous$$ouseUp)?

avatar image fafase · Apr 10, 2013 at 08:00 PM 0
Share

Oops not, my bad, I thought of Get$$anonymous$$ouseButtonUp. I'm out...

avatar image Praetoracle · May 22, 2015 at 07:16 PM 0
Share

Can someone please clarify this? I am having the same issue, but @fafase answer is not making sense.

avatar image fafase · May 24, 2015 at 08:08 AM 0
Share

This is not even a comment. I guess I left it so that the user could see that the answer was wrong but it should be removed.

Concerning the content of it, as mentioned in a comment, I thought it was using Get$$anonymous$$ouseButtonUp which would fail in the FixedUpdate and should be moved to Update to make sure all calls are successful.

For a more detailed comment, On$$anonymous$$ouseXXX only works with 3D collider so it could be a guess if one is trying to use it on 2D sprite. Also, I have experienced buggy behaviour of that event and favored a basic raycast system ins$$anonymous$$d.

avatar image
0

Answer by JtheSpaceC · May 22, 2015 at 07:37 PM

You'd mostly be checking for the input in one of your Update functions.

  void Update()
     {
     if (Input.GetMouseButtonUp (0)) 
             {
                 //do something
             }
     }


If you're in update then you're checking every frame and shouldn't miss any input ticks. If the above function were within FixedUpdate() then you're checking at regular timed intervals and might miss the Down or Up parts of checks.

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 fafase · May 24, 2015 at 08:22 AM 0
Share

It is a On$$anonymous$$ouseXXX event method so it is not related to the Update/FixedUpdate.

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

14 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 avatar image avatar image avatar image avatar image

Related Questions

Animate Button/Object When Clicked In Game 2 Answers

OnMouseUp and GUITexture 1 Answer

OnMouseUp not working in build? 0 Answers

OnMouseDown 2 Answers

On Mouse Up On Multiple GUI Texts 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