1
\$\begingroup\$

Input.GetMouseButtonDown(0.....6); - in documentation it says that you can pass, 0, 1, 2 as parameter. Input.GetMouseButtonDown. It doesn't accept negative numbers like -1 or numbers 7+. What does 3 4 5 6 do? What input are they calculating? Or can I use these numbers as default for None state? I couldn't find any information about this.

\$\endgroup\$
2
\$\begingroup\$

0 is the left mouse button, 1 is the right ,2 is the middle. The rest are there for mice with extra buttons. Like some gaming mice have buttons on the side. For example using this code :

void Update () {
        if(Input.GetMouseButton(3))
        {
            Debug.Log(true);
        }
    }

and pressing my 4th mouse button I get true in the console.

\$\endgroup\$
  • \$\begingroup\$ Do you know if there is default mouse input like KeyCode.None? I don't want to check for numbers in my loop if that is not necessary. \$\endgroup\$ – Candid Moon _Max_ Mar 6 '17 at 20:12
  • \$\begingroup\$ All I can think of is Input.anyKey. But the GetMouseButton method only accepts integers. \$\endgroup\$ – Uri Popov Mar 6 '17 at 20:17
  • \$\begingroup\$ Also, wanted to add for people who found this question - those who are using Event.current to get what key or mouse button was pressed - buttons 3, 4, aren't going to get any reaction. Event.current.isMouse = false when you press 3 and 4 at least on my mouse and I have no more buttons, so I could not check with 5 and 6. So this is not a way to bind those buttons inside the game by Event.current.button. For 0, 1, 2 it's working nice. \$\endgroup\$ – Candid Moon _Max_ Mar 7 '17 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.