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
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
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.
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.
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.