Input
Class
Interface into the Input system.
Use this class to read the axes set up in the Input Manager.
To read an axis use Input.GetAxis with one of the following default axes:
"Horizontal" and "Vertical" are mapped to joystick, A, W, S, D and the arrow keys.
"Mouse X" and "Mouse Y" are mapped to the mouse delta.
"Fire1", "Fire2" "Fire3" are mapped to Ctrl, Alt, Cmd keys and three mouse or joystick buttons.
New input axes can be added in the Input Manager.
If you are using input for any kind of movement behaviour use Input.GetAxis.
It gives you smoothed and configurable input that can be mapped to keyboard, joystick or mouse.
Use Input.GetButton for action like events only. Don't use it for movement, Input.GetAxis will make the script code smaller and simpler.
Class Variables
| mousePosition |
The current mouse position in pixel coordinates.
|
| anyKey |
Is any key or mouse button currently held down? (Read Only)
|
| anyKeyDown |
Returns true the first frame the user hits any key or mouse button (Read Only).
|
| inputString |
Returns the keyboard input entered this frame (Read Only).
|
Class Functions
| GetAxis |
Returns the value of the virtual axis identified by axisName.
|
| GetAxisRaw |
Returns the value of the virtual axis identified by axisName with no smoothing filtering applied.
|
| GetButton |
Returns true while the virtual button identified by buttonName is held down.
|
| GetButtonDown |
Returns true during the frame the user pressed down the virtual button identified by buttonName.
|
| GetButtonUp |
Returns true the first frame the user releases the virtual button identified by buttonName.
|
| GetKey |
Returns true while the user holds down the key identified by name. Think auto fire.
|
| GetKeyDown |
Returns true during the frame the user starts pressing down the key identified by name.
|
| GetKeyUp |
Returns true during the frame the user releases the key identified by name.
|
| GetMouseButton |
Returns whether the the given mouse button is held down.
|
| GetMouseButtonDown |
Returns true during the frame the user pressed the given mouse button.
|
| GetMouseButtonUp |
Returns true during the frame the user releases the given mouse button.
|
| ResetInputAxes |
Resets all input. After ResetInputAxes all axes return to 0 and all buttons return to 0 for one frame.
|
|