Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed Jun 01, 2016 at 05:24 PM by xyHeat for the following reason:

La question est hors-sujet ou n'est pas pertinente

avatar image
0
Question by xyHeat · Jun 01, 2016 at 10:45 AM · mouse button

Mouse button up and down

Hi everybody ! I'm just want to know what's the difference between : "Input.GetMouseButtonDown(0)" and "Input.GetMouseButtonUp(0)"

Some one can help me ? Thank you, xyHeat

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

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by HarshadK · Jun 01, 2016 at 11:46 AM

Read the documentation for Input.GetMouseButtonDown and Input.GetMouseButtonUp.

From the same documentation:

Input.GetMouseButtonDown: Returns true during the frame the user pressed the given mouse button. You need to call this function from the Update function, since the state gets reset each frame. It will not return true until the user has released the mouse button and pressed it again. button values are 0 for left button, 1 for right button, 2 for the middle button.

Input.GetMouseButtonUp: Returns true during the frame the user releases the given mouse button. You need to call this function from the Update function, since the state gets reset each frame. It will not return true until the user has pressed the mouse button and released it again. button values are 0 for left button, 1 for right button, 2 for the middle button.

The 0 passed as argument to these methods indicate the left mouse button.

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 xyHeat · Jun 01, 2016 at 05:11 PM 1
Share

Thank you for this answer ! I'm sorry, i didn't realize that my question was so stupid...

avatar image
0

Answer by TheCheatsrichter · Jun 01, 2016 at 12:13 PM

Just imagen the mouse button itself.

When you press it down Input.GetMouseButtonDown() will return true. The moment you release it (button goes up) Input.GetMouseButtonUp() will return true.

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 xyHeat · Jun 01, 2016 at 05:10 PM 0
Share

Thank you, now i this about it, i realise how much this question was stupid...

avatar image
0

Answer by Mmmpies · Jun 01, 2016 at 11:25 AM

Really?!

OK well one is used for drag DOWN and the other for click UP. Think about it when you drag something the mouse button will be down all the time and to release you let go with an up event. Any engine has to include all the states for a device to work properly.

Comment
Add comment · Show 5 · 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 HarshadK · Jun 01, 2016 at 11:48 AM 0
Share

one is used for drag DOWN

Actually this is done via Input.Get$$anonymous$$ouseButton which will be called for each frame the mouse button is held down.

avatar image Mmmpies HarshadK · Jun 01, 2016 at 11:53 AM 0
Share

Really I was more explaining why you need to have both down and up as the question was so basic. Possibly they're trolling but maybe not, to a new user it might not be obvious they do different things.

avatar image HarshadK Mmmpies · Jun 01, 2016 at 01:04 PM 0
Share

Got it. That makes sense.

Show more comments
avatar image Mmmpies · Jun 01, 2016 at 05:17 PM 1
Share

There are no stupid questions but there some stupid people who get a laugh out of posting very simple questions to waste peoples time.

Clearly, from your response, that isn't what you were doing so don't worry about it - like I said to @Harshad$$anonymous$$ it's quite possible for someone new to Unity not to see the difference immediately as a mouse click is a mouse click regardless of down or up.

Follow this Question

Answers Answers and Comments

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

Related Questions

getting maximum x and y values of mouse position 1 Answer

Subnautica Type swimming 2 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