- Home /
What is The Javascript name for "Left Mouse Click"
What is The Javascript name for "Left Mouse Click" I am making that the button I use to fire and can't seem to find it.
Answer by Eric5h5 · Apr 21, 2010 at 03:20 AM
There isn't any, but you can use the Unity function called GetMouseButtonDown(0). 1 is for the right button and 2 is for the middle button. There's a corresponding GetMouseButtonUp(0), as well as GetMouseButton(0), which returns true every frame as long as the mouse button is down.
Alternately, you can set up a button in the input manager. That way you can make a mouse button, joystick button, gamepad button, keyboard key, etc. all do the same thing, and the button can be configured by the user when running a stand-alone build. Then you use GetButtonDown("NameOfButton")--depending on what you called the button in the input manager--as well as GetButtonUp and GetButton.
Srry, but im confused. Could you think go step by step in the input manager on how to make a button the "left mouse button"
Go to the input manager, select one of the existing entries or make a new one, use "mouse 0" for the positive button or alt positive button, then make sure the type is "key or mouse button".