GetMouseButtonUp

So I always learned that ButtonUp (for key or mouse) is usually the best practice for handling input in games(probably from early GDTV courses… and it depends on circumstances, sure) so it was always painful that through the entire course we use ButtonDown. Occasionally for things I went ahead and made it button up. It’s always nice to always have the feedback of holding the mouse button down and then letting go when you are good and ready to complete an action anyway.

The funny thing is that the movement issue when leaving the targeting IEnumerator is completely avoided if you just use MouseButtonUp. I almost didn’t believe that my theory of this being true would work before I tried it as he was adding the extra nonsense to keep another loop going while the button is held down. Which… I imagine is HOW MouseButtonUp works anyway :rofl: :rofl: :rofl:

Am I crazy here?

Hey, if it works!

In general, MouseButtonUp or MouseButtonDown is a question of responsiveness… If you were in a shooter, would you want the gun to fire when you click the mouse or when you release… or to rephrase that… if you were in a real gunfight, would you want the gun to fire when you pulled the trigger or when you released. Here’s my thoughts on the best time for the right action:

OnMouseButtonDown

  • Shooting a weapon.
  • Swinging a sword.
  • Firing a thruster
  • Implenting a turn/move
  • Beginning a drag selection

OnMouseButtonUp

  • Moving a chess piece
  • Throwing a hand grenade
  • Ending a drag selection
  • Dragging a resource into the scene
2 Likes

Oh for sure it is about responsiveness. For this course specifically I was more speaking about the Save/Load/Delete save. That one can certainly afford to be ButtonUp. And obviously the target selection stuff lends itself to it.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms