Search Unity

Documentation error GetMouseButtonDown()

Discussion in 'Scripting' started by NYGhost, Nov 19, 2007.

  1. NYGhost

    NYGhost

    Joined:
    Sep 20, 2007
    Posts:
    55
    it does returns before the mouse is released. :?: :?: :?:
    Code (csharp):
    1.  
    2. if( Input.GetMouseButtonDown(0) ) {
    3.     print("before release.");
    4. }
    5.  
    [/quote]
     
  2. Mr. Animator

    Mr. Animator

    Joined:
    Oct 2, 2005
    Posts:
    193
    I think you're just mis-understanding what the docs are saying. I guess it should say "It will not return true AGAIN until the user has released..." but its clear enough to me.

    If you're trying to make something only trigger when the mouse button is released, you might try using the function OnMouseUp ().
     
  3. NYGhost

    NYGhost

    Joined:
    Sep 20, 2007
    Posts:
    55
    Thanks, I thought I did :wink:
    I still think that
    is a redundancy, the first paragraph establishes very well what it does and when.
     
  4. Mr. Animator

    Mr. Animator

    Joined:
    Oct 2, 2005
    Posts:
    193
    True enough, it may be redundant, but I think they're just trying to be extra clear on the difference between GetMouseButtonDown and GetMouseButton, which will return true over and over as long as the button is down.

    I guess the docs could be accused of being overinformative :)